In the attached NT8 MACD script, the line plot order was changed to plot the MACD Differential histogram first, then MACD Average above that, then MACD on top of all. After the plot order change, the Diff histogram and the MACD Average functions and plots as desired, but the MACD line does not plot. I must be missing something simple. Any suggestions? Thank you!
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
MACD line not plotting after change of plot order
Collapse
X
-
MACD line not plotting after change of plot order
In the attached NT8 MACD script, the line plot order was changed to plot the MACD Differential histogram first, then MACD Average above that, then MACD on top of all. After the plot order change, the Diff histogram and the MACD Average functions and plots as desired, but the MACD line does not plot. I must be missing something simple. Any suggestions? Thank you!Last edited by Lancer; 02-07-2021, 08:53 PM.Tags: None
-
Hello,
The AddPlot(Brushes.Red, "Macd"); would generate Values[2].
I see Macd is returning Values[2].
public Series<double> Macd { get { return Values[2]; } }
I don't see anywhere Macd[0] or Values[2][0] is being assigned a value.
If there is no value assigned, no value will plot..
The line:
double Macd = MACD(Fast, Slow, Smooth)[0];
Makes a localized double value and makes the series inaccessible. Trying using a different name for the local variable within the scope of OnBarUpdate.
Chelsea B.NinjaTrader Customer Service
-
ChelseaB, that was it.
At AddPlot, changed "Macd" to "MacdValue"
Changed "Value[0] = Macd;" to "MacdValue[0] = Macd;"
At Values[2], changed "Macd" to "MacdValue",
At "double priorMacd = Value[1];", changed to "double priorMacd = MacdValue[1];"
Now the Macd line plots. Thank you very much!!
Attached is the working file.Attached Files
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by charlesugo_1, 05-26-2026, 05:03 PM
|
0 responses
68 views
0 likes
|
Last Post
by charlesugo_1
05-26-2026, 05:03 PM
|
||
|
Started by DannyP96, 05-18-2026, 02:38 PM
|
1 response
151 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 05-11-2026, 05:56 AM
|
0 responses
162 views
0 likes
|
Last Post
by CarlTrading
05-11-2026, 05:56 AM
|
||
|
Started by CarlTrading, 05-10-2026, 08:12 PM
|
0 responses
100 views
0 likes
|
Last Post
by CarlTrading
05-10-2026, 08:12 PM
|
||
|
Started by Hwop38, 05-04-2026, 07:02 PM
|
0 responses
288 views
0 likes
|
Last Post
by Hwop38
05-04-2026, 07:02 PM
|

Comment