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 NullPointStrategies, Yesterday, 05:17 AM
            0 responses
            63 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            139 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            75 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            45 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            50 views
            0 likes
            Last Post TheRealMorford  
            Working...
            X