Max
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Need Help With Color Coded MACD
Collapse
X
-
Need Help With Color Coded MACD
I've downloaded the MACDUpDn indicator which plots a different color for upticks and downticks in the histogram. What I would like to do is the same thing for the MACD plot itself. Is there anyone that would care to help me? Thanks and Best Regards
MaxTags: None
-
Originally posted by maxreturn View PostI've downloaded the MACDUpDn indicator which plots a different color for upticks and downticks in the histogram. What I would like to do is the same thing for the MACD plot itself. Is there anyone that would care to help me? Thanks and Best Regards
Max
Hi Max,
Here we go: Place this piece of code after line 78.
if (Rising(Value))
{
MacdRisingPlot.Set(1, Value[1]);
MacdRisingPlot.Set(Value[0]);
}
else if (Falling(Value))
{
MacdFallingPlot.Set(1, Value[1]);
MacdFallingPlot.Set(Value[0]);
}
else
{
MacdNeutralPlot.Set(1, Value[1]);
MacdNeutralPlot.Set(Value[0]);
}
Then in line 40, i.e: Add(new Plot(Color.Green, "Macd"));
Copy it twice below this one and change "Macd" with MacdRisingPlot, MacdFallingPlot,MacdNeutralPlot and also choose the colors you wish.
Finally in the properties Section find:
[Browsable(false)]
[XmlIgnore()]
public DataSeries Default
{
get { return Values[0]; }
}
again copy it twice, replace "Default" as above with MacdRisingPlot, MacdFallingPlot,MacdNeutralPlotand and in Values increase by one: Values[0], Values[1],Values[2].
Also, change the values that the other plots had ie Avg from [1] now [4],
2->5, 3->6 .
Cheers
-
Astra, thanks a bunch. I understand most of what you said but I'm a little confused about the last part. I understand copying the "default" twice and having MacdRisingPlot, MacdFalingPlot and MacdNeutralPlot but I'm confused about the values. If I understand you correctly you're saying to have values 0-2 for the new plots and then change all the other values correct? Also, I noticed that there are two lines of code "///Summary" before and after each piece of code in this section. Do I need to edit the code to include this before and after my new plots? Again, thanks for all your help!
Best Regards
Max
Comment
-
Originally posted by maxreturn View PostAstra, thanks a bunch. I understand most of what you said but I'm a little confused about the last part. I understand copying the "default" twice and having MacdRisingPlot, MacdFalingPlot and MacdNeutralPlot but I'm confused about the values. If I understand you correctly you're saying to have values 0-2 for the new plots and then change all the other values correct? Also, I noticed that there are two lines of code "///Summary" before and after each piece of code in this section. Do I need to edit the code to include this before and after my new plots? Again, thanks for all your help!
Best Regards
Max
Max,
Give me few minutes and I will make it ready for you. Maybe others (including myself!) will benefit as well.
If in the meantime you like to have a go (I remember how it feels when
I managed my first code in C#!), the idea is that you have to match the sequence the plots are placed under Initialize, in the properties section, starting from 0. So, the first plot under Initialize, in the properties section will be
{
get { return Values[0]; }
}
The second [1], and so on. Don't bother about the summaries, either live them or delete them.
astra
Comment
-
-
What Can I say Astra. HUGH ROCK! Thank you so much. I will study the code and try to brush up so I can do more of this on my own. I am a professional trader. If there's anything I can ever to do help you please let me know. God Bless!Originally posted by astra View PostMax,
Here is your requested indicator. I left the Macd as transparent in case you need the value for a strategy. Also, I have added background color (if you don't need it you can remove this line of code).
Have a nice day.
Max
Comment
-
Astra, slight problem with MACD plot
Hello Astra. I just did a visual inspection of the indicator and it appears there's a slight problem I believe is just limited to the MacdFallingPlot. For some reason in a number of cases even the the MACD plot clearly ticks down it stays th same color as MacdRisingPlot. I verified this by looking in the data window. Even though it ticks down both MacdRisingPlot and MacdFallingPlot show a value.
Regards
Max
BTW...I love the background color.
Comment
-
Hello Astra. I just did a visual inspection of the indicator and it appears there's a slight problem I believe is just limited to the MacdFallingPlot. For some reason in a number of cases even the the MACD plot clearly ticks down it stays th same color as MacdRisingPlot. I verified this by looking in the data window. Even though it ticks down both MacdRisingPlot and MacdFallingPlot show a value.Originally posted by astra View PostHi Max,
I am happy to have been of help.
Best wishes,
astra
Regards
Max
BTW...I love the background color.
Comment
-
Oopps! You have right. It is fixed now. Please download it again from my previous post. The reason was that when I changed the plot name from Value to MacdPlot I overlooked to make the changes in some places. Now it should plot correctly. Thanks for telling me.
Comment
-
Astra, once again...thanks for your generous help. If there's anything I can ever do for you...just let me know. God Bless.Originally posted by astra View PostOopps! You have right. It is fixed now. Please download it again from my previous post. The reason was that when I changed the plot name from Value to MacdPlot I overlooked to make the changes in some places. Now it should plot correctly. Thanks for telling me.
Regards
Max
Comment
-
Astra, there are still problems
Hello Astra. I downloaded and imported the revised indi and there is still a problem on several datapoints where the MACD clearly ticks down but for some reason the color stays the same as when the MACD ticks up. Any ideas? Thanks for all your help.
Regards
Max
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
574 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
332 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
553 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