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 > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 06-03-2011, 02:52 AM   #1
stevescott05
Member
 
Join Date: Apr 2008
Location: Seattle, WA
Posts: 47
Thanks: 0
Thanked 1 time in 1 post
Default Add(SMA())

Easy one for ya, I know I've done this before, not working for me now though.

Making a new indicator, want this new indicator to also plot a few SMA's over the price data. I'm using:

Add(SMA(PeriodTrendFast));

in the Initialize() area. Where PeriodTrendFast is a variable already listed in the Variables section. Keeps giving me 1729 1502 and 1503 errors for wrong overloads. Do I need something in the Properties area?

Help?

Thanks,

S
stevescott05 is offline  
Reply With Quote
Old 06-03-2011, 03:10 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,404
Thanks: 252
Thanked 974 times in 957 posts
Default

Hi Steve, yes if you refer to the public property in your code you would need to add the corresponding parts in the properties section as well, you could see an example in the SampleMaCrossOver strategy.
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 06-03-2011, 06:32 AM   #3
koganam
Senior Member
 
Join Date: Feb 2008
Location: Durham, North Carolina, USA
Posts: 3,201
Thanks: 24
Thanked 1,228 times in 999 posts
Send a message via Skype™ to koganam
Default

Quote:
Originally Posted by stevescott05 View Post
Easy one for ya, I know I've done this before, not working for me now though.

Making a new indicator, want this new indicator to also plot a few SMA's over the price data. I'm using:

Add(SMA(PeriodTrendFast));

in the Initialize() area. Where PeriodTrendFast is a variable already listed in the Variables section. Keeps giving me 1729 1502 and 1503 errors for wrong overloads. Do I need something in the Properties area?

Help?

Thanks,

S
I believe you "Add()" indicators to a Strategy, not to another indicator. If you want to call an indicator from another indicator, you just call it with the correct signature.

It is probably more efficient to create an instance, then call that specific instance when needed. That way you bypass NinjaTrader cycling through all instances, looking for the correct one to call, on every OnBarUpdate(). (Part of the NT magic code automatically added as part of a wrapper). Just think if you had the calling indicator on more than one chart, and had CalculateOnBarClose = false. Eek, a few million calls on some /ES bars?
koganam 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
indicator to plot the 50 period sma of the 5 sma brdnickel NinjaScript File Sharing Discussion 6 01-26-2011 01:03 PM
Sma kaywai General Programming 16 01-26-2010 09:49 AM
Sma rtj4201 Charting 1 04-11-2009 07:48 AM
Draw a x minute SMA/SMA/WMA on another timeframe? ninjamouse Indicator Development 4 04-06-2009 06:54 AM
Cannot add return of SMA() RandyT Indicator Development 1 09-25-2008 06:10 AM


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