NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > NinjaScript Development Support > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 02-17-2010, 06:42 PM   #1
T2020
Senior Member
 
Join Date: Jun 2008
Posts: 650
Thanks: 0
Thanked 0 times in 0 posts
Default Syntax question

I've created moving averages of other things like :

Value.Set(SMA(OBV(), Period)[0]);

Which worked fine , but the snap shot doesn't .
It looks like it could use one more ..... ) ......
but that gives an error to .

It's just an experiment . thx .
Attached Images
File Type: jpg Sample code error.jpg (7.1 KB, 10 views)
Last edited by T2020; 02-17-2010 at 06:51 PM.
T2020 is offline  
Reply With Quote
Old 02-18-2010, 05:27 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,570
Thanks: 262
Thanked 1,018 times in 999 posts
Default

T2020, you would need to pass a dataseries to the SMA, not a double (no index after the Middle) -

Code:
 
SMA(Bollinger(1, 30).Middle, 20)
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 02-18-2010, 06:06 AM   #3
T2020
Senior Member
 
Join Date: Jun 2008
Posts: 650
Thanks: 0
Thanked 0 times in 0 posts
Default

Quote:
Originally Posted by NinjaTrader_Bertrand View Post
T2020, you would need to pass a dataseries to the SMA, not a double (no index after the Middle) -

Code:
 
SMA(Bollinger(1, 30).Middle, 20)
So , just that one set of brackets basically . Not sure I'll ever make it as a
programmer . Thank you .
T2020 is offline  
Reply With Quote
Old 02-18-2010, 06:19 AM   #4
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,570
Thanks: 262
Thanked 1,018 times in 999 posts
Default

Yes, without choosing to retrieve an index value a dataseries is passed to the SMA - when you apply an index you retrieve a double value of the Middle dataseries...this generated the error you ran into, an SMA needs a history to calculate thus a dataseries is expected.
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
formula / syntax question . T2020 General Programming 9 12-17-2009 04:32 PM
Syntax Problems skat100 Automated Trading 3 06-01-2009 08:27 AM
Problem of Syntax germano Strategy Development 13 04-02-2009 10:55 AM
Syntax Problems skat100 Strategy Development 77 12-16-2008 08:47 AM
Plotting Question - Syntax tazatek Indicator Development 1 07-16-2008 06:25 PM


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