Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Ma crossover
Collapse
X
-
Hello brucelevy,
Thanks for your post today.
This can be done by adding an if and an else if statement. You could configure the code so that when the Value of your MA is greater than the Close of the Current Bar, the indicator will change the bars of the data series. And when the value of your MA is less the Close of the Current Bar, to change the colors of the bars to something else.
I have included an example of this would be done. Under OnBarUpdate():
[/LEFT]Code:[COLOR=#000000][FONT=Tahoma][LEFT]if (Close[0 ] > Value[0])[COLOR=#000000][FONT=Tahoma][LEFT] {[/LEFT] [/FONT][/COLOR][COLOR=#000000][FONT=Tahoma][LEFT] BarColor = Color.Blue;[/LEFT] [/FONT][/COLOR][COLOR=#000000][FONT=Tahoma][LEFT] CandleOutlineColor = Color.Blue;[/LEFT] [/FONT][/COLOR][COLOR=#000000][FONT=Tahoma][LEFT] }[/LEFT] [/FONT][/COLOR][COLOR=#000000][FONT=Tahoma][LEFT] else if (Close[0] < Value[ 0])[/LEFT] [/FONT][/COLOR][COLOR=#000000][FONT=Tahoma][LEFT] {[/LEFT] [/FONT][/COLOR][COLOR=#000000][FONT=Tahoma][LEFT] BarColor = Color.Orange;[/LEFT] [/FONT][/COLOR][COLOR=#000000][FONT=Tahoma][LEFT] CandleOutlineColor = Color.Orange;[/LEFT] [/FONT][/COLOR][COLOR=#000000][FONT=Tahoma][LEFT] }[/LEFT] [/FONT][/COLOR]
[/FONT][/COLOR]
I have also included a link to our help guide on BarColor to assist you further.
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
579 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
334 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
554 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
551 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment