NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Strategy Development

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

Reply
 
Thread Tools Display Modes
Old 12-30-2010, 08:21 AM   #1
richp6
Member
 
Join Date: Mar 2009
Posts: 69
Thanks: 0
Thanked 2 times in 2 posts
Default Resetting Variables

Hi,

I'm trying to reset certain variables at the beginning of each session. I'm running my strategy on a 60 min chart, but I also have 15 min and 1 min bars added to the strategy. I'm also running it with COBC = false.

I was trying this expression:

if (Bars.FirstBarOfSession && BarsInProgress == 2)
with BarsInProgress (2) being the 1 min bar. When looking at the output window though, I'm getting multiple resets for about the first 15 min, then the routine stops. My expectation is that it runs once and is done. Is it running on all the ticks during the first minute?

I also have part of my strategy running on FirstTickOfBar. Should I put the routine in there?

Thanks,

Rich
richp6 is offline  
Reply With Quote
Old 12-30-2010, 08:27 AM   #2
NinjaTrader_RyanM
NinjaTrader Customer Service
 
NinjaTrader_RyanM's Avatar
 
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
Default

Hi Rich,

Are you using version 6.5 or 7? There have been changes to multiseries for version 7 and want to make sure I'm checking this out for the right version.
NinjaTrader_RyanM is offline  
Reply With Quote
Old 12-30-2010, 08:28 AM   #3
richp6
Member
 
Join Date: Mar 2009
Posts: 69
Thanks: 0
Thanked 2 times in 2 posts
Default

I'm using version 7
richp6 is offline  
Reply With Quote
Old 12-30-2010, 09:09 AM   #4
NinjaTrader_RyanM
NinjaTrader Customer Service
 
NinjaTrader_RyanM's Avatar
 
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
Default

Thanks.

I believe this should work better for you.

if (BarsInProgress == 2)
{
if (Bars.FirstBarOfSession && FirstTickOfBar)
Print("First Bar of 1 minute " + Times[2][0]);
}
NinjaTrader_RyanM is offline  
Reply With Quote
Old 12-30-2010, 09:10 AM   #5
richp6
Member
 
Join Date: Mar 2009
Posts: 69
Thanks: 0
Thanked 2 times in 2 posts
Default

I'll check it out tomorrow morning. Thanks!
richp6 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
Resetting Sim101 cgeorgan Version 7 Beta General Questions & Bug Reports 1 08-11-2010 09:10 AM
Resetting a variable trader413 Strategy Development 8 09-14-2009 10:12 AM
resetting indicators dirtybrown Indicator Development 9 06-01-2009 02:06 PM
Resetting account performance ? T2020 Miscellaneous Support 2 09-08-2008 07:25 AM
Data values resetting Burga1 Indicator Development 5 05-23-2008 03:25 PM


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