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 09-24-2008, 11:13 PM   #1
RandyT
Member
 
Join Date: Sep 2008
Posts: 75
Thanks: 0
Thanked 0 times in 0 posts
Default Cannot add return of SMA()

Nasty looking code alert... just trying to port some TS code

I get a compile error when trying to compile this code.

"Operator '+' cannot be applied to operands of type 'NinjaTrader.Indicator.SMA and 'NinjaTrader.Indicator.SMA" which would be adding two doubles.

What am I missing...

ST1 = 100 *(Close - ((
SMA(Close,Len1) +
SMA(SMA(Close,Len1),Len1) +
SMA(SMA(SMA(Close,Len1),Len1),Len1) +
SMA(SMA(SMA(SMA(Close,Len1),Len1),Len1),Len1) +
SMA(SMA(SMA(SMA(SMA(Close,Len1),Len1),Len1),Len1), Len1) +
SMA(SMA(SMA(SMA(SMA(SMA(Close,Len1),Len1),Len1),Le n1),Len1),Len1) +
SMA(SMA(SMA(SMA(SMA(SMA(SMA(Close,Len1),Len1),Len1 ),Len1),Len1),Len1),Len1) +
SMA(SMA(SMA(SMA(SMA(SMA(SMA(SMA(Close,Len1),Len1), Len1),Len1),Len1),Len1),Len1),Len1) +
SMA(SMA(SMA(SMA(SMA(SMA(SMA(SMA(SMA(Close,Len1),Le n1),Len1),Len1),Len1),Len1),Len1),Len1),Len1) +
SMA(SMA(SMA(SMA(SMA(SMA(SMA(SMA(SMA(SMA(Close,Len1 ),Len1),Len1),Len1),Len1),Len1),Len1),Len1),Len1), Len1))
/ 10)) / (High(Close, Len2) - Low(Close, Len2));
RandyT is offline  
Reply With Quote
Old 09-25-2008, 06:10 AM   #2
NinjaTrader_Ben
NinjaTrader Customer Service
 
NinjaTrader_Ben's Avatar
 
Join Date: May 2008
Location: Denver, CO
Posts: 3,157
Thanks: 0
Thanked 3 times in 3 posts
Default

Hello,

Try including an index after each SMA(). For example the first one may look like this:

SMA(Close, Len1)[0] + etc...

The next one may look like this:

SMA(SMA(Close,Len1),Len1)[0] + etc...

This link may help:
http://www.ninjatrader-support.com/H...verageSMA.html
Last edited by NinjaTrader_Ben; 09-25-2008 at 06:13 AM.
NinjaTrader_Ben 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
Market analyzer and chart return different values nicko9 Market Analyzer 5 08-04-2010 05:26 AM
How to return the Position Entry Price?? Ninja in Training Strategy Development 3 08-05-2008 10:06 AM
Standard Return Code for Functions arbifox Automated Trading 1 12-13-2007 08:21 PM
Positions[0].Quantity return negative value when short? Folls Strategy Development 2 10-23-2007 01:13 PM
Return values for NTOrderStatus() ccooper Automated Trading 2 11-11-2006 11:47 AM


All times are GMT -6. The time now is 02:58 PM.