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

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.
    JesseNinjaTrader Customer Service

    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.
        JesseNinjaTrader Customer Service

        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.
            JesseNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by traderqz, Yesterday, 12:06 AM
            11 responses
            27 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by PaulMohn, Today, 03:49 AM
            0 responses
            7 views
            0 likes
            Last Post PaulMohn  
            Started by inanazsocial, Today, 01:15 AM
            1 response
            10 views
            0 likes
            Last Post NinjaTrader_Jason  
            Started by rocketman7, Today, 02:12 AM
            0 responses
            10 views
            0 likes
            Last Post rocketman7  
            Started by dustydbayer, Today, 01:59 AM
            0 responses
            4 views
            0 likes
            Last Post dustydbayer  
            Working...
            X