Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strat's & Indi's ONLy update historical. OnBarUpdate never fires

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

    Strat's & Indi's ONLy update historical. OnBarUpdate never fires

    For some reason several of my related strats and indis only print historical calcs. The OnBarUpdate does not fire off when new bars form. Can someone give me a hit list of things to check. Why might this happen? thanks.

    #2
    Hello Kicks.Spin,

    The only item which comes to mind would be if you were using AddDataSeries with a Trading Hours template, in some cases there are expectations to OnBarUpdate not being called. We would likely need further details on what you made to know if that relates to your logic in some way. You could try creating a new empty script and placing only a print in OnBarUpdate to see if that works also.

    I look forward to being of further assistance.

    Comment


      #3
      Your right That is exactly what is going on. Here is the statement. It's not working well. Simply trying to be aware of the RTH Max & Min.
      AddDataSeries( this.Instrument.FullName, new BarsPeriod{ BarsPeriodType = BarsPeriodType.Minute, Value = 450 }, "CME US Index Futures RTH");

      Comment


        #4
        Hello Kicks.Spin,

        If you are using hours which are greater than the hours of that statement for the same instrument then OnBarUpdate will wait for all bars to be in trading hours. This is documented on the AddDataSeries page.

        If that is the situation you would need to use one of the other overloads which don't take a trading hours and then use conditions in your logic if you need to filter something to RTH hours.

        I look forward to being of further assistance.

        Comment


          #5
          Thanks Jesse:
          I wrote the following to store previous RTH High & Low rather than AddDataSeries. Please comment if you recommend a better way.
          if (ToTime(Time[1]) < ToTime(9, 30, 00) && ToTime(Time[0]) >= ToTime(9, 30, 00)) {RTHstartbar = CurrentBar;}
          if (ToTime(Time[1]) < ToTime(17, 00, 00) && ToTime(Time[0]) >= ToTime(17, 00, 00)) {RTHendbar = CurrentBar;}
          RTHmaxvalue = MAX(High, RTHendbar - RTHstartbar)[0];
          RTHminvalue = MIN(Low, RTHendbar - RTHstartbar)[0];

          Comment


            #6
            Hello Kicks.Spin,

            That seems fine if you just needed to find the general time and get the bar index to later find a BarsAgo. The only other way to work with trading hours would be more complicated and involve using the actual TradingHours objects. Using some hard coded times would generally be the most simple approach if this was intended to be used with a specific instrument/symbols that share common RTH hours. You could also expand on that by adding a user input to configure the time if needed.

            I look forward to being of further assistance.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by CarlTrading, 03-31-2026, 09:41 PM
            1 response
            47 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            23 views
            0 likes
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            33 views
            1 like
            Last Post CaptainJack  
            Started by CarlTrading, 03-30-2026, 11:51 AM
            0 responses
            50 views
            0 likes
            Last Post CarlTrading  
            Started by CarlTrading, 03-30-2026, 11:48 AM
            0 responses
            42 views
            0 likes
            Last Post CarlTrading  
            Working...
            X