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 06-12-2012, 09:35 PM   #1
er111222
Member
 
Join Date: Mar 2011
Posts: 53
Thanks: 7
Thanked 0 times in 0 posts
Default Bars.FirstBarOfSession only show 1 day in backtest

I have problem when using this code in backtest in 1 range chart that it only show 1 day of result when back testing multiple days. Am I missing something?

Code:
if(Bars.BarsSinceSession)
{
}
er111222 is offline  
Reply With Quote
Old 06-13-2012, 04:42 AM   #2
NinjaTrader_Joydeep
NinjaTrader Customer Service
 
NinjaTrader_Joydeep's Avatar
 
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
Default

Hello er111222,
Bars.BarsSinceSession returns an integer.
Code:
if (Bars.BarsSinceSession == 3)
{
  //do something
}
http://www.ninjatrader.com/support/h...ncesession.htm

If you want to check if the bar is the first bar of session then please use the FirstBarOfSession function.
Code:
if (Bars.FirstBarOfSession)
{
  //do something
}
http://www.ninjatrader.com/support/h...rofsession.htm

Please let me know if I can assist you any further.
NinjaTrader_Joydeep is offline  
Reply With Quote
Old 06-13-2012, 05:52 AM   #3
er111222
Member
 
Join Date: Mar 2011
Posts: 53
Thanks: 7
Thanked 0 times in 0 posts
Default

Sorry I mean the problem happened when use
Code:
if (Bars.FirstBarOfSession)
{
  //do something
}
Only one day of backtest result shown.
er111222 is offline  
Reply With Quote
Old 06-13-2012, 06:03 AM   #4
NinjaTrader_Joydeep
NinjaTrader Customer Service
 
NinjaTrader_Joydeep's Avatar
 
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
Default

Hello er111222,
Can you send a toy code* replicating the scenario to support[AT]ninjatrader[DOT]com

Please append Attn:Joydeep in the subject line of the email and give a reference of this thread in the body of the email.

I look forward to assisting you further.

*The "toy" just means something that is a stripped down version that isn't necessarily the whole logic. It makes things easier to rout out.
NinjaTrader_Joydeep 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
Bars.FirstBarOfSession trtrav Strategy Development 5 06-27-2011 10:48 AM
Bars.FirstBarOfSession doesn't work with Renko bars gregid Version 7 Beta General Questions & Bug Reports 20 05-24-2010 08:17 AM
Bars.FirstBarOfSession MXASJ Version 7 Beta General Questions & Bug Reports 5 05-17-2010 08:28 AM
why does not Bars.FirstBarOfSession not fired junkone Strategy Development 3 04-29-2009 09:42 AM
Bars.FirstBarOfSession not set to true during backtest? tradefaz General Programming 1 09-03-2008 08:19 AM


All times are GMT -6. The time now is 10:06 PM.