Repainting Historical Bar - futures io
futures io futures trading



Repainting Historical Bar


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one srgtroy with 3 posts (1 thanks)
    2. looks_two Fat Tails with 2 posts (2 thanks)
    3. looks_3 Big Mike with 1 posts (1 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
      Best Posters
    1. looks_one Fat Tails with 1 thanks per post
    2. looks_two bukkan with 1 thanks per post
    3. looks_3 Big Mike with 1 thanks per post
    4. looks_4 srgtroy with 0.3 thanks per post
    1. trending_up 2,260 views
    2. thumb_up 5 thanks given
    3. group 2 followers
    1. forum 7 posts
    2. attach_file 0 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

Repainting Historical Bar

(login for full post details)
  #1 (permalink)
Legendary Market Wizard
Los Angeles, California Republic
 
Experience: None
Platform: Sierra Chart
Broker: CQG
Trading: ES
 
srgtroy's Avatar
 
Posts: 1,936 since Jan 2011
Thanks: 1,375 given, 3,714 received

I'm trying to create a situation where if a bar meets a certain condition it gets painted red, however, if the bar following it fails to meet another condition, the initial bar gets re-painted dark red.

Here is my code:

if (BoolSeries1[0])
{BarColor = Color.Red;
}

if (Historical && BoolSeries1[0] && !BoolSeries2[-1])
{
BarColor = Color.DarkRed;
}


Why is it painting the following bar dark red instead of the initial one?

Started this thread Reply With Quote

Can you help answer these questions
from other members on futures io?
NT8 indicator to simulate a Funding Evaluation where to …
NinjaTrader
COTbase for quant trading?
Elite Algorithmic NinjaTrader Trading
Indicators for pair trading MES and M2K
Platforms and Indicators
ZigZag with Depth and Backstep
EasyLanguage Programming
Where can I find Cost to Trade and Book Depth info?
Emini and Emicro Index
 
Best Threads (Most Thanked)
in the last 7 days on futures io
Battlestations: Show us your trading desks!
137 thanks
Big Mike in Ecuador
34 thanks
Want your NinjaTrader indicator created, free?
32 thanks
Saturday Morning Market Replay!
20 thanks
Selling Options on Futures?
19 thanks
 
(login for full post details)
  #3 (permalink)
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: My own custom solution
Trading: Emini Futures
 
Big Mike's Avatar
 
Posts: 49,790 since Jun 2009
Thanks: 32,314 given, 97,610 received


Historical is only true while backtesting or while a chart is being loaded/drawn for the first time after you open it. It is not true once it is fully loaded.

That said, I can't help with how to paint backwards on the price bars - don't have ninja installed anymore - but as for making an indicator repaint all you do is modify the array 1 bar back, like:

myArray[1] = newValue;

Probably similar for price bars. Hopefully someone can help.

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/
Follow me on Twitter Visit my futures io Trade Journal Reply With Quote
The following user says Thank You to Big Mike for this post:
 
(login for full post details)
  #4 (permalink)
Calcutta, India
 
Experience: Intermediate
Platform: ArthaChitra
 
Posts: 278 since Jun 2009
Thanks: 161 given, 269 received


srgtroy View Post
I'm trying to create a situation where if a bar meets a certain condition it gets painted red, however, if the bar following it fails to meet another condition, the initial bar gets re-painted dark red.

Here is my code:

if (BoolSeries1[0])
{BarColor = Color.Red;
}

if (Historical && BoolSeries1[0] && !BoolSeries2[-1])
{
BarColor = Color.DarkRed;
}


Why is it painting the following bar dark red instead of the initial one?

dont know what exactly u r upto but if -1 represents previous bar then it should be only 1.

Reply With Quote
The following user says Thank You to bukkan for this post:
 
(login for full post details)
  #5 (permalink)
Market Wizard
Berlin, Europe
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,855 since Mar 2010
Thanks: 4,238 given, 26,731 received


srgtroy View Post
I'm trying to create a situation where if a bar meets a certain condition it gets painted red, however, if the bar following it fails to meet another condition, the initial bar gets re-painted dark red.

Here is my code:

if (BoolSeries1[0])
{BarColor = Color.Red;
}

if (Historical && BoolSeries1[0] && !BoolSeries2[-1])
{
BarColor = Color.DarkRed;
}


Why is it painting the following bar dark red instead of the initial one?

I did not answer this in the first place because several things are confused. So let me summarize:

-> BarColor will only paint the current bar, you cannot use it to paint back.
-> "Historical" cannot be used this way. "Historical" refers to historical data as stored in the historical data base.If you connect to a data provider, typically NinjaTrader will backfill historical data for the time prior to connection and then collect real-time data. The previous bar, which you wanted to paint, can therefore be a real-time data bar. The use you made of "Historical" does not make any sense.
-> As @ bukkan pointed out, if you want to reference the previous value of a BoolSeries, it would be BoolSeries[1], Boolseries[-1] will likely throw an out of range exception as the value has not been set.

What are you actually trying to achieve?

Reply With Quote
The following user says Thank You to Fat Tails for this post:
 
(login for full post details)
  #6 (permalink)
Legendary Market Wizard
Los Angeles, California Republic
 
Experience: None
Platform: Sierra Chart
Broker: CQG
Trading: ES
 
srgtroy's Avatar
 
Posts: 1,936 since Jan 2011
Thanks: 1,375 given, 3,714 received

I define a Marubozu bar with a certain set of parameters. If the current bar meets those requirements, it gets painted green if it is an up bar or red if it is a down bar. However, the following bar is the confirmation bar. If it doesn't show sufficient follow through as defined by another set of parameters, then the initial Marubozu bar has 'failed' and that bar gets repainted a darker shade to show that status.

"-1" was used on purpose to refer to the next bar (confirmation bar), not the last bar.

The code was supposed to work like this: If this is the current bar, and it meets my definition of Marubozu, paint it red or green. However, if it is not the current bar, but it meets my definition of Marubozu, check the next bar and see if it has been confirmed. If it hasn't been confirmed, paint it the darker shade.

-> BarColor will only paint the current bar, you cannot use it to paint back.

I assume this means I cannot do what I would like to do as described above?

Thanks for your response and patience.

Started this thread Reply With Quote
The following user says Thank You to srgtroy for this post:
 
(login for full post details)
  #7 (permalink)
Market Wizard
Berlin, Europe
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,855 since Mar 2010
Thanks: 4,238 given, 26,731 received


srgtroy View Post
I define a Marubozu bar with a certain set of parameters. If the current bar meets those requirements, it gets painted green if it is an up bar or red if it is a down bar. However, the following bar is the confirmation bar. If it doesn't show sufficient follow through as defined by another set of parameters, then the initial Marubozu bar has 'failed' and that bar gets repainted a darker shade to show that status.

"-1" was used on purpose to refer to the next bar (confirmation bar), not the last bar.

The code was supposed to work like this: If this is the current bar, and it meets my definition of Marubozu, paint it red or green. However, if it is not the current bar, but it meets my definition of Marubozu, check the next bar and see if it has been confirmed. If it hasn't been confirmed, paint it the darker shade.

-> BarColor will only paint the current bar, you cannot use it to paint back.

I assume this means I cannot do what I would like to do as described above?

Thanks for your response and patience.

I just remembered that there is an easy way of doing what you want to do.

Instead of BarColor, you can use BarColorSeries. For example

 
Code
BarColorSeries[1] = Color.Red;
will paint the previous bar red. That should solve your problem. Sorry, should have seen this earlier.

Reply With Quote
The following user says Thank You to Fat Tails for this post:
 
(login for full post details)
  #8 (permalink)
Legendary Market Wizard
Los Angeles, California Republic
 
Experience: None
Platform: Sierra Chart
Broker: CQG
Trading: ES
 
srgtroy's Avatar
 
Posts: 1,936 since Jan 2011
Thanks: 1,375 given, 3,714 received

Wow! Great! Thanks!

Started this thread Reply With Quote


futures io Trading Community Platforms and Indicators NinjaTrader > Repainting Historical Bar


Last Updated on July 16, 2011


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Battlestations! Show us your trading desk - $1,500 in prizes!

March
 

Importance of Finding Your Own Way w/Adam Grimes

Elite only
 

Journal Challenge w/Jigsaw

April
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts