NexusFi: Find Your Edge


Home Menu

 





Can bars be 'colored' by another bar state?


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one Trader.Jon with 4 posts (0 thanks)
    2. looks_two MooreTech with 2 posts (2 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 aslan with 1 posts (1 thanks)
    1. trending_up 4,270 views
    2. thumb_up 3 thanks given
    3. group 4 followers
    1. forum 8 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
 
Trader.Jon's Avatar
 Trader.Jon 
Near the BEuTiFULL Horse Shoe
 
Experience: Beginner
Platform: NinjaTrader
Broker: MBTrading Dukascopy ZenFire
Trading: $EURUSD when it is trending
Posts: 473 since Jul 2009
Thanks Given: 401
Thanks Received: 184

I have looked at Point n Figure (PnF) barcharts occasionally, and do think of making a strategy built on some of that functionality.

Meanwhile, I wonder if it is possible to color (example) range bars (bearish, bullish) based on the last 'state' of the PnF whether the last drawn was an 'O' or an 'X' ?? Likely best done only in NT7 as PnF is 'native' there. Would this best be done as a new bar type or as an indicator? From the discussions about bar types here I am not too keen on even attempting those

I did look at the code of the NT7 '@BarsTypes.cs" but cant make enough sense of it to know where to start getting the 'trigger' to change the color state of the range bar. Of course, I want to still be able to change the input parameters available in NT7 to change the PnF bar parameters.

Any help is appreciated (but I am am still a novice at code writing and specific example code is ssSSOOO useful, generalization of steps will likely just get me asking more questions),



TIA
Jon


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
UMA Votes Tonight: Polymarkets $80M Strategy Bitcoin Bat …
Prediction Markets & Event Contracts
Wood Mackenzie Drops $200 Oil Forecast -- Airspace Expir …
Prediction Markets & Event Contracts
Post-Summit Scorecard: $36M in May 15 Bets Settle Near-Z …
Prediction Markets & Event Contracts
Iran Fired a Missile at Israel Last Night. The $8M June …
Prediction Markets & Event Contracts
Sundays Verdict: Lebanon Locked at 99.85% as Iran June 7 …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
8 thanks
Darmok and Jalad at Tanagra
1 thanks
  #3 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Legendary Market Wizard
 
Experience: Advanced
Platform: NinjaTrader
Broker: Interactive Brokers
Trading: Futures & Stocks
Posts: 9,887 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,117



Trader.Jon View Post
I have looked at Point n Figure (PnF) barcharts occasionally, and do think of making a strategy built on some of that functionality.

Meanwhile, I wonder if it is possible to color (example) range bars (bearish, bullish) based on the last 'state' of the PnF whether the last drawn was an 'O' or an 'X' ?? Likely best done only in NT7 as PnF is 'native' there. Would this best be done as a new bar type or as an indicator? From the discussions about bar types here I am not too keen on even attempting those

I did look at the code of the NT7 '@BarsTypes.cs" but cant make enough sense of it to know where to start getting the 'trigger' to change the color state of the range bar. Of course, I want to still be able to change the input parameters available in NT7 to change the PnF bar parameters.

Any help is appreciated (but I am am still a novice at code writing and specific example code is ssSSOOO useful, generalization of steps will likely just get me asking more questions),



TIA
Jon

NinjaTrader has a zigzag indicator, which can probably be used to simulate a point and figure chart. All you would need to do is to substitute the minimum devaition of the zig zag for the reversal size of the point and figure chart. Make sure that the zigzag is attached to the close. Once a zigzag is drawn, this starts a new column of your P&F charts. You can easily use this approach to colour your bars.


Reply With Quote
  #4 (permalink)
 MooreTech 
Orlando, Florida
 
Experience: Advanced
Platform: NinjaTrader, TradeStation, MultiCharts, eSignal, MetaTrader
Trading: ES
Posts: 57 since Aug 2010
Thanks Given: 6
Thanks Received: 73

Jon,
I think it would be easiest for you to create an indicator to do this. I have the following code that I think you could modify this pretty easily to suit your needs.

 
Code
                            

ind
.Set(Close[0]);                        
                        
            if (
trend==1)
            {
                if (
ind[0]<=hw)
                {
                    
trend=-1;
                    
hw=ind[0]+signal*TickSize;
                    
tnum++;
                    
DrawArrowDown(tnum.ToString(),true,0,High[0]+2*TickSize,Color.Red);
                    
signaled=true;
                }
                else 
hw=Math.Max(hw,ind[0]-signal*TickSize);
                                
                
BarColor=Color.Blue;                                
            }
            
            else if (
trend==-1)
            {
                if (
ind[0]>=hw)
                {
                    
trend=1;
                    
hw=ind[0]-signal*TickSize;
                    
tnum++;
                    
DrawArrowUp(tnum.ToString(),true,0,Low[0]-2*TickSize,Color.Green);
                    
signaled=true;
                }
                else 
hw=Math.Min(hw,ind[0]+signal*TickSize);
                                
                
BarColor=Color.Red;
            }        
            
            else
            {
                
trend=1;
                
hw=ind[0]-signal*TickSize;
            } 

Trader.Jon View Post
I have looked at Point n Figure (PnF) barcharts occasionally, and do think of making a strategy built on some of that functionality.

Meanwhile, I wonder if it is possible to color (example) range bars (bearish, bullish) based on the last 'state' of the PnF whether the last drawn was an 'O' or an 'X' ?? Likely best done only in NT7 as PnF is 'native' there. Would this best be done as a new bar type or as an indicator? From the discussions about bar types here I am not too keen on even attempting those

I did look at the code of the NT7 '@BarsTypes.cs" but cant make enough sense of it to know where to start getting the 'trigger' to change the color state of the range bar. Of course, I want to still be able to change the input parameters available in NT7 to change the PnF bar parameters.

Any help is appreciated (but I am am still a novice at code writing and specific example code is ssSSOOO useful, generalization of steps will likely just get me asking more questions),



TIA
Jon


Follow me on X Reply With Quote
Thanked by:
  #5 (permalink)
 
aslan's Avatar
 aslan 
Madison, WI
Market Wizard
 
Experience: Advanced
Platform: ALT
Trading: ES
Posts: 624 since Jan 2010
Thanks Given: 356
Thanks Received: 1,129

I dont do PnF charts, but here are a few comments:

* BarTypes are for building bars, not really the right place to color a bar

* ChartStyles are for displaying the bars in a custom manner, you could set the color here, but since you want to use another bar type to set the color of this bar type, it is not going to be easy to do, if its even possible

* Indicator - this is the place to do it, as an indicator can also set the color of the bars based on pretty much anything you can get access to. I think you could add another data series to an indicator (i.e. add a PnF period bar), and then use the state of the second data source to color the bars. This is a NT7 feature.

Perhaps others have some more ideas.


Reply With Quote
Thanked by:
  #6 (permalink)
 
Trader.Jon's Avatar
 Trader.Jon 
Near the BEuTiFULL Horse Shoe
 
Experience: Beginner
Platform: NinjaTrader
Broker: MBTrading Dukascopy ZenFire
Trading: $EURUSD when it is trending
Posts: 473 since Jul 2009
Thanks Given: 401
Thanks Received: 184


Fat Tails View Post
NinjaTrader has a zigzag indicator, which can probably be used to simulate a point and figure chart. All you would need to do is to substitute the minimum devaition of the zig zag for the reversal size of the point and figure chart. Make sure that the zigzag is attached to the close. Once a zigzag is drawn, this starts a new column of your P&F charts. You can easily use this approach to colour your bars.

That approach had never even crossed my mind ... I'll put it on my 'to do' for my eyeballs and see what it looks like!

Thanks,
Jon


Started this thread Reply With Quote
  #7 (permalink)
 
Trader.Jon's Avatar
 Trader.Jon 
Near the BEuTiFULL Horse Shoe
 
Experience: Beginner
Platform: NinjaTrader
Broker: MBTrading Dukascopy ZenFire
Trading: $EURUSD when it is trending
Posts: 473 since Jul 2009
Thanks Given: 401
Thanks Received: 184


MooreTech View Post
Jon,
I think it would be easiest for you to create an indicator to do this. I have the following code ... }

[/PHP]

Moore,

1 vote for indicator !!!

Thanks for the inspiration ... I will give a go at it, I do wonder though if its going to be an issue as the PnF bars have multiple segments, and waiting on the bar close will effect the outcome ... 'top of my head' guess at the code snip you provided looks as designed for bar to be closed .. or am I wrong?

Jon


Started this thread Reply With Quote
  #8 (permalink)
 
Trader.Jon's Avatar
 Trader.Jon 
Near the BEuTiFULL Horse Shoe
 
Experience: Beginner
Platform: NinjaTrader
Broker: MBTrading Dukascopy ZenFire
Trading: $EURUSD when it is trending
Posts: 473 since Jul 2009
Thanks Given: 401
Thanks Received: 184


aslan View Post
I dont do PnF charts, but here are a few comments:

* BarTypes are for building bars, not really the right place to color a bar

* ChartStyles are for displaying the bars in a custom manner, you could set the color here, but since you want to use another bar type to set the color of this bar type, it is not going to be easy to do, if its even possible

* Indicator - this is the place to do it, as an indicator can also set the color of the bars based on pretty much anything you can get access to. I think you could add another data series to an indicator (i.e. add a PnF period bar), and then use the state of the second data source to color the bars. This is a NT7 feature.

Perhaps others have some more ideas.

Aslan,

2 votes for indicator !!!


I appreciate the analysis of the options ... I parsed out the PnF parts from the NT7 BarsType.cs and will use that to help me chart these unknown waters.

Jon


Started this thread Reply With Quote
  #9 (permalink)
 MooreTech 
Orlando, Florida
 
Experience: Advanced
Platform: NinjaTrader, TradeStation, MultiCharts, eSignal, MetaTrader
Trading: ES
Posts: 57 since Aug 2010
Thanks Given: 6
Thanks Received: 73

Jon,
You can run the code provided intrabar (CalculateOnBarClose=false).


Trader.Jon View Post
Moore,

1 vote for indicator !!!

Thanks for the inspiration ... I will give a go at it, I do wonder though if its going to be an issue as the PnF bars have multiple segments, and waiting on the bar close will effect the outcome ... 'top of my head' guess at the code snip you provided looks as designed for bar to be closed .. or am I wrong?

Jon


Follow me on X Reply With Quote




Last Updated on August 13, 2010


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts