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 sjsj2732, 03-23-2026, 04:31 AM
|
0 responses
49 views
0 likes
|
Last Post
by sjsj2732
03-23-2026, 04:31 AM
|
||
|
Started by NullPointStrategies, 03-13-2026, 05:17 AM
|
0 responses
300 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
294 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
139 views
1 like
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
98 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|

Comment