protected override void OnBarUpdate()
{
// Use this method for calculating your indicator values. Assign a value to each
// plot below by replacing 'Close[0]' with your own formula.
if (MACD(12,26,9).Diff[0] > 0 && MACD(12,26,9)[0] > 0)
BarColor = Color.Green;
else if (MACD(12,26,9).Diff[0] < 0 && MACD(12,26,9)[0] < 0)
BarColor = Color.Red;
}
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Assigning indicator values
Collapse
X
-
Assigning indicator values
Hello, I have the snippet of code where the following conditions paint the bar red or green:
Now, I plan on using the indicator in a strategy and was wondering how to set something like: if the bar is red, then value of the indicator == 0, and if the bar if green, then set the value of the indicator == 1 .. or something like this. I just want to be able to call out a 0, or 1 (for red or green bars) when building the strategy..thxCode:Tags: None
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
572 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
331 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
549 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
550 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment