Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Why is Historical flag true on launch with live enabled?

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

    #16
    To further drive my point home:

    I have changed the OBU method a little:

    Code:
    if (BarsInProgress == 0) {
    				
    	if(FirstTickOfBar) {
    	    Print("**** 0 FTOB ****");
    	    Print("Zero series time: " + Times[0][0]);
    	    Print("One series time: " + Times[1][0]);
    	    Print("isHistoricalBOT = " + isHistoricalBOT);
    	    Print("Historical = " + Historical);
    	    Print("Times[0][0] <= Times[1][0] = " + (Times[0][0] <= Times[1][0]));
    	    Print("Last 0 bar: " + lastBars[0]);
    	    Print("Last 1 bar: " + lastBars[1]);
    	    Print("***************");
          }
    }
    And the output I'm getting:

    **** 0 FTOB ****
    Zero series time: 7/30/2013 18:05:00
    One series time: 7/30/2013 18:04:59
    isHistoricalBOT = True
    Historical = True
    Times[0][0] <= Times[1][0] = False
    Last 0 bar: False
    Last 1 bar: False
    ***************
    **** 0 FTOB ****
    Zero series time: 7/30/2013 18:10:00
    One series time: 7/30/2013 18:09:58
    isHistoricalBOT = True
    Historical = True
    Times[0][0] <= Times[1][0] = False
    Last 0 bar: False
    Last 1 bar: False
    ***************
    **** 0 FTOB ****
    Zero series time: 7/30/2013 18:15:00
    One series time: 7/30/2013 18:11:14
    isHistoricalBOT = False
    Historical = True
    Times[0][0] <= Times[1][0] = False
    Last 0 bar: True
    Last 1 bar: True
    So at that last incident we have the 0 series ahead of the 1 series, which I consider live. And it also is the last 0 bar and last 1 bar. All that combined says 'strategy is live' to me - at least for my purposes. As you can see your Historical flag still claims it is true. You say that it's the last historical tick - but given the above test and the above output this doesn't make sense to me. Sorry for being thick - perhaps someone can enlighten me.

    Apologies for harping on this issue again - it's been a big headache for me in the past few months and I finally want to put it to rest. Thanks in advance for any input/thoughts on the matter.

    Comment


      #17
      Mole,

      Perhaps we are defining 'real-time' differently. I understand that you are looking for the exact time the strategy is started, but keep in mind the last OBU call will be on a historical bar. By design, our Historical Flag is going to be evaluated as false as soon as the real-time data source is started, not not necessarily when the strategy is live. I'd encourage you to explore custom methods for identifying the condition you're looking for.
      MatthewNinjaTrader Product Management

      Comment


        #18
        Originally posted by NinjaTrader_Matthew View Post
        Mole,

        Perhaps we are defining 'real-time' differently. I understand that you are looking for the exact time the strategy is started, but keep in mind the last OBU call will be on a historical bar. By design, our Historical Flag is going to be evaluated as false as soon as the real-time data source is started, not not necessarily when the strategy is live. I'd encourage you to explore custom methods for identifying the condition you're looking for.
        Okay, that is reasonable and obviously I'm working on implementing such method. But then I would suggest a new NinjaTrader setting for the NinjaScript tab: "Set Historical to false on start of strategy" Or something along those lines.

        To 99.9% of NT coders this issue will be completely unaware of this issue but it may affect many of them, especially if they run several series in their strategy.

        Comment


          #19
          Originally posted by molecool View Post
          Okay, that is reasonable and obviously I'm working on implementing such method. But then I would suggest a new NinjaTrader setting for the NinjaScript tab: "Set Historical to false on start of strategy" Or something along those lines.

          To 99.9% of NT coders this issue will be completely unaware of this issue but it may affect many of them, especially if they run several series in their strategy.
          Now that this seems to be concluded, let me put in a word edgewise.

          I have been well aware of what you say: it is just that I always thought that it was reasonable the Historical property would be true on FirstTickOfBar, as the previous bar would have just closed and become Historical, before the evaluation that this was the FTOB.

          But, I do see your point, and because of it, in many cases, I use a different method to determine the FTOB. I seem to recollect that you also use it sometimes; namely: if (lastBar != CurrentBar) {...}

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          607 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          353 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          105 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          560 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          561 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X