Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

FirstTickOfBar On Historical Data

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

    FirstTickOfBar On Historical Data

    Hi,

    I would like to perform some operations on the equity market open.

    What I have now in my OnBarUpdate function is:
    if (Bars.FirstBarOfSession && FirstTickOfBar)

    The FirstTickOfBar is there so that these operations are not repeated over and over during the first minute of trading but instead, just performed once.

    This should work fine if the strategy is enabled when the market opens. However, my concern is that if I enable these strategies after the market opens then the opening bars will be treated as historical OHLC bars (as in the case of backtesting) rather than on a tick by tick basis (and therefore the FirstTickOfBar will not return true). Is this indeed the case?

    Thanks in advance!
    Last edited by wuilengh; 09-03-2012, 08:16 AM.

    #2
    Right, FirstTickOfBar only works on live data, not historical. A workaround would be to instead do your calculations at a certain time rather than on the first tick of the opening bar.

    Comment


      #3
      Hello Wuelengh,

      Thank you for your post.

      Radical is correct here as FirstTickOfBar will only work on a tick by tick basis which would not help you in the case that you enable the strategy after the open.

      In this case you can use ToTime() to call a specific time (such as the time of the open). For information on ToTime() please visit the following link: http://www.ninjatrader.com/support/h...nt7/totime.htm

      Please let me know if I may be of further assistance.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      67 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      36 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      60 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      62 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      53 views
      0 likes
      Last Post CarlTrading  
      Working...
      X