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 > Strategy Development

Strategy Development Support for the development of custom automated trading strategies using NinjaScript.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 03-31-2010, 11:02 AM   #1
binwang2
Senior Member
 
Join Date: Jan 2009
Posts: 216
Thanks: 0
Thanked 1 time in 1 post
Default On SampleMultiTimeFrame

Hi NT experts,

In your sample code on SampleMultiTimeFrame, the condition is to process event on BarsInProgress =0:
if (BarsInProgress != 0)
return;

However, the following code starts to evalaute values on BarsInProgress 1 and 2:
if (SMA(BarsArray[1], 5)[0] > SMA(BarsArray[1], 50)[0] && SMA(BarsArray[2], 5)[0] > SMA(BarsArray[2], 50)[0])

I would assume SMA(BarsArray[1], 5)[0] would produce an error as it tries to get value from BarsArray[1] instead of 0.

A realted question. What if no such contions as
if (BarsInProgress != 0) return;

Will this sample prouce same results?

Regards,


binwang2 is offline  
Reply With Quote
 

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


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