View Full Version : Modified MACD Indicator
07-22-2011, 07:56 AM
As a NOOB NinjaScript guy, I am trying to modify a renamed version of the MACD indicator. Attached is the standard code and I thought that I should be able to change the two PLOT lines:
Add(new Plot(Color.Green, "Macd"));
Add(new Plot(Color.DarkViolet, "Avg"));
/// Add(new Plot(Color.Green, "Macd"));
/// Add(new Plot(Color.DarkViolet, "Avg"));
But now the Indicator doesn't plot anything?
07-22-2011, 08:10 AM
Thank you for your post.
If you were trying to remove these two plots by commenting them out the add method, there are more changes you would need to make in the OnBarUpdate and Properties section of the code.
Rather than removing the plots, would it be easier for you to change the Colors to transparent instead?
Add(new Plot(Color.Transparent, "Macd"));
Add(new Plot(Color.Transparent, "Avg"));
07-22-2011, 08:13 AM
Matthew - thanks. At first I thought no but made a change to the Auto scale field and this worked. Bravo!
07-22-2011, 08:26 AM
Great to hear!
Since you're just getting started with NinjaScript, I would suggest keeping a close eye on the log tab of the control center for any errors when adding your project to a chart.
If you're unable to determine what is causing the errors, you can use try-catch blocks over various segments in your code and that will trap wherever the issue is stemming from.
Please see our Reference Sample on using Try-Catch blocks to debugg your code:
Have a great weekend and happy coding!