Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Referencing the Color of a Previous Bar
Collapse
X
-
Referencing the Color of a Previous Bar
Is it possible to access the color property of a previous bar. For example if "X condition" is true, then set current bar color equal to bar color "y" bars ago?Tags: None
-
i found a work-around that may/may not help you ...
my task was to color the next X bars after a condition was triggered ... so i started with something as simple as this:
Code:// place this in variables section private int intCounter = 0; // counter private int intNumBars = 5; // number of bars to paint // place this inside of OnBarUpdate() if ( (...your condition here...) || intCounter > 0) { // paint the bar if (intCounter < intNumBars) { BarColor = Color.Red; } // increment counter intCounter = intCounter + 1; // reset counter after number exceeds max if (intCounter > intNumBars) { intCounter = 0; } } ...
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by tidicofx, Today, 12:02 AM
|
1 response
7 views
0 likes
|
Last Post Today, 06:47 AM | ||
Started by Mindset, Yesterday, 10:31 PM
|
1 response
13 views
0 likes
|
Last Post Today, 06:41 AM | ||
Started by endystrike, 12-06-2016, 09:52 AM
|
145 responses
8,612 views
0 likes
|
Last Post Today, 06:28 AM | ||
Started by pickles1774, 02-28-2024, 12:34 PM
|
3 responses
39 views
0 likes
|
Last Post Today, 06:27 AM | ||
Started by PaulMohn, Yesterday, 05:51 PM
|
1 response
12 views
0 likes
|
Last Post Today, 06:20 AM |
Comment