NinjaTrader Support Forum  

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 05-08-2012, 07:00 PM   #1
Turtle Trader
Senior Member
 
Join Date: May 2009
Posts: 343
Thanks: 0
Thanked 0 times in 0 posts
Default Indicator with SMA

I want to make an indicator something like the Ninja MACrossBuilder indicator...but with 4 different moving averages (instead of 2) plotting.

I don't need to have the period, et cetera, selectable in the parameters...they would be fixed in the code as they don't change.

Any examples to look at?
Turtle Trader is offline  
Reply With Quote
Old 05-09-2012, 02:41 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,555
Thanks: 261
Thanked 1,013 times in 994 posts
Default

Turtle Trader, I think you can take the template from Ryan here - http://www.ninjatrader.com/support/f...h=cross&desc=1

and then just dont expose the parameters as public properties, but instead hardcode their values into the method calls.

Of course you then also need to add extra plots as per your needs.
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 05-09-2012, 03:04 AM   #3
Turtle Trader
Senior Member
 
Join Date: May 2009
Posts: 343
Thanks: 0
Thanked 0 times in 0 posts
Default reply

hi Bertrand,

That link does not go anywhere, can you repost it?

Thank you.
Turtle Trader is offline  
Reply With Quote
Old 05-09-2012, 03:12 AM   #4
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,555
Thanks: 261
Thanked 1,013 times in 994 posts
Default

The link goes to our sharing, which contains an MA cross builder shared by our RyanM, this could be a template for your works - http://www.ninjatrader.com/support/f...catid=4&id=426
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 05-09-2012, 03:18 AM   #5
Turtle Trader
Senior Member
 
Join Date: May 2009
Posts: 343
Thanks: 0
Thanked 0 times in 0 posts
Default reply

Hi Bertrand,

I clicked again and the link worked...search results. thank you.

Though, I'm a newbie a Ninja coder....can you give me an example of how to assign attributes, like Period, MA Type, et cetera, to a Plot in the code? And assign a DataSeries to a Plot?

I've read the MA Cross Builder and don't see where those are being applied...they are in the parameters but not assigned to the DataSeries in the code..?

And, how is a DataSeries applied to a Plot?

Is there a class I can take to know these things?

Thank you.
Turtle Trader is offline  
Reply With Quote
Old 05-09-2012, 03:28 AM   #6
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,555
Thanks: 261
Thanked 1,013 times in 994 posts
Default

If you're new to coding in NinjaScript, best would be checking through those tutorials for indicator coding we have prepared - http://www.ninjatrader.com/support/h.../tutorials.htm

Those would cover the basics needed for custom work and modifications.

The MA Builder code shared uses so called user defined inputs to set paramters - a tip in the education section explains those further - http://www.ninjatrader.com/support/f...ead.php?t=5782

If you just want to hardcode a period in, then assign the parameter in your MA method call for example - double mySMA = SMA(Close, 10)[0]; >> here the period is hardcoded to 10, there be no exposed user input dictating what is used, it will always be the coded in 10.
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 05-09-2012, 10:19 AM   #7
Turtle Trader
Senior Member
 
Join Date: May 2009
Posts: 343
Thanks: 0
Thanked 0 times in 0 posts
Default thank you

thank you Bertrand
Turtle Trader is offline  
Reply With Quote
Old 05-09-2012, 10:29 AM   #8
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,555
Thanks: 261
Thanked 1,013 times in 994 posts
Default

You're welcome, if you run into any walls on this project please post and let us know.
NinjaTrader_Bertrand 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
Discrepancy between plotted SMA and Indicator SMA? Bogomir28 Indicator Development 2 03-24-2012 03:49 PM
SMA Indicator ryebank General Programming 1 07-05-2011 03:52 AM
Directing SMA of Indicator to the Indicator panel oz-dog Automated Trading 4 06-16-2011 06:34 AM
indicator to plot the 50 period sma of the 5 sma brdnickel NinjaScript File Sharing Discussion 6 01-26-2011 01:03 PM
SMA of an indicator erinys Indicator Development 3 12-20-2009 01:08 PM


All times are GMT -6. The time now is 07:10 PM.