Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

FirstBarOfSession value?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    FirstBarOfSession value?

    Hi

    I have a strategy that starts when it sees the first bar of the session, as indicated by Bars.FirstBarOfSession, and looks for a condition in the first 10 minutes of the session. After that the strategy does no more.
    I need to understand what the value of Bars.FirstBarOfSession is in the following unusual situation because my strategy started unexpectedly.

    Situation:
    My strategy is started before the session start, so it waits as expected.
    The PC (laptop) goes into hibernation before the session starts (so no data is obtained).
    The user wakes up the laptop several hours after the session starts.
    My strategy starts as though the current baris the first bar, even though the time is many bars after the session start.

    Perhaps I need to also check the bar time to prevent this late start in circumstances like this - please confirm.

    Regards
    Tony

    #2
    Hi Tony, that's a correct a time filter would prevented this action - did the user reload historical data before the strategy was started then after the hibernation period?

    If there was no data, it would treat the first live seen bar then as it's first bar correctly triggering the logic.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Thank you for clarifying that, Bertrand.

      For safety, I need my program to be fool-proof for when unforeseen things happen. I'll go with the bar time check against the session start time.

      Regards
      Tony

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by trilliantrader, Today, 08:16 AM
      2 responses
      6 views
      0 likes
      Last Post trilliantrader  
      Started by samish18, Today, 08:31 AM
      1 response
      1 view
      0 likes
      Last Post NinjaTrader_Clayton  
      Started by Creamers, 09-08-2023, 10:26 AM
      6 responses
      157 views
      0 likes
      Last Post JonyGurt  
      Started by funk10101, Today, 08:14 AM
      1 response
      2 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by bill2023, Yesterday, 08:51 AM
      3 responses
      22 views
      0 likes
      Last Post bltdavid  
      Working...
      X