I am looking to change the macd line from lets say red to green when the macd line cross the macd avg. I want the macd line to stay green for the initial cross candle and then the two candles after. Once there has been 4 candles I want it to go back to red. Is this something that can be done easily?
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Change MACD Line color when it cross the Avg
Collapse
X
-
Change MACD Line color when it cross the Avg
Hello,
I am looking to change the macd line from lets say red to green when the macd line cross the macd avg. I want the macd line to stay green for the initial cross candle and then the two candles after. Once there has been 4 candles I want it to go back to red. Is this something that can be done easily?Tags: None
-
Hello durdcash,
Thank you for your post.
This should be possible without too much hassle. I suggest checking out the multi-colored plots reference sample here for an example of changing plot colors when certain conditions are met:
If you are wanting it to stay green for a set number of candles, you will likely need to record the CurrentBar index when the crossover condition is met in a variable, then add a check if the new CurrentBar is greater than or equal to the saved bar index plus however many bars since the crossover and if so, change the plot to red again.
Crossovers can be detected with CrossAbove() and CrossBelow():Please let us know if we may be of further assistance.
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
647 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
369 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
108 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
572 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
573 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment