NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Indicator Development

Indicator Development Support for the development of custom indicators using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 08-28-2007, 06:10 AM   #1
gdargento
Member
 
Join Date: Dec 2004
Location: , Illinois, USA
Posts: 56
Thanks: 0
Thanked 0 times in 0 posts
Send a message via AIM to gdargento Send a message via MSN to gdargento
Default MACD Histogram

I've been trying to copy, rename (including the class name) and modify the MACD indicator that comes with Ninja to display the histogram only without success.

What controls what is displayed by the indicator? In the stock MACD I commented out part of the following in hopes of displaying only the hist:

//Add(new Plot(Color.Green, "Macd"));
//Add(new Plot(Color.DarkViolet, "Avg"));
Add(new Plot(new Pen(Color.Navy, 2), PlotStyle.Bar, "Diff"));

The result was a blank panel 2.

Thanks
gdargento is offline  
Reply With Quote
Old 08-28-2007, 10:15 AM   #2
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

Hi gdargento,

The reason you are getting a blank panel is because the Diff plot uses the Macd and Avg plots to calculate its value. This means you cannot simply comment out those two plots. What you need to do instead is change those plots into DataSeries instead. Using the DataSeries class allows you to maintain the plot values, but without the plotting graphics. You can review the exact details about them here: http://www.ninjatrader-support.com/H...taSeriesObject.

So basically this is what you want to do:
1) Add two DataSeries variables (Macd, Avg) to the Variables section.
Code:
private DataSeries     Macd;
private DataSeries     Avg;
2) In the Initialize() section you want to do
Code:
Macd = new DataSeries(this);
Avg = new DataSeries(this);
3) In the Initialize() section you want to delete/comment out those two plots you already did
4) In the Properties section you want to delete the first two blocks of "public DataSeries" (delete Avg and Default).
5) In the Properties section you want to modify the remaining DataSeries (Diff) to be placed into the proper index by replacing the 2 with a 0.
Code:
get { return Values[0]; }
Hope that helps. If you have any more questions please feel free to ask.
NinjaTrader_Josh is offline  
Reply With Quote
Old 08-28-2007, 11:04 AM   #3
gdargento
Member
 
Join Date: Dec 2004
Location: , Illinois, USA
Posts: 56
Thanks: 0
Thanked 0 times in 0 posts
Send a message via AIM to gdargento Send a message via MSN to gdargento
Default MACD Hist

Much appreciated. Works!
gdargento is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
MACD Crossover nybangali General Programming 25 10-29-2010 02:11 PM
Turning off Avg. & MACD lines jeremymgp Charting 1 08-11-2007 04:41 AM
Using MACD.avg vs. MACD Jim-Boulder Strategy Development 1 05-23-2007 07:41 AM
Histogram support scjohn General Programming 1 05-14-2007 12:41 PM
Histogram like Woodies CCI? funk101 Indicator Development 1 05-06-2007 07:56 AM


All times are GMT -6. The time now is 09:57 AM.