Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnBarUpdate not invoked if multiple contracts and one expires

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

    OnBarUpdate not invoked if multiple contracts and one expires

    Hello,

    I am developing a strategy that uses mulitple futures contracts, substituting them for the continuous contract isn't possible.

    Contracts are added via Add("ES 03-14", PeriodType.Day, 1);

    The strategy will be run on the continuous contract.

    The rather curious behaviour is that if I add e.g "ES 03-14" and "ES 06-14" the last OnBarUpdate invocation will be on the day the oldest contract "ES 03-14" expires.

    Once there is no data for one of the data series no further calculations will be made.

    Is there some kind of workaround? All my intervals are set to daily, maybe there is another event that fires which I can replace OnBarUpdate with? All I need is the price data for the day, no indicators or other fancy stuff is required.

    #2
    I got lucky and found a solution, after setting
    CalculateOnBarClose = false;
    all the other dates will be processed too.
    Not exactly transparent, but I'll take it.

    Comment


      #3
      Hello MojoJojo,

      Thank you for your post and welcome to the NinjaTrader Support Forum!

      I am not certain I fully understand your inquiry based on your solution found.

      NinjaTrader automatically merges contracts using Merge Policies, so you could potentially use the current contract as the input seris and it would act as a continuous contract when using a Merge Policy of MergeBackAdjusted or MergeNonBackAdjusted.

      For information on the Merge Policies please visit the following link: http://www.ninjatrader.com/support/h...rical_data.htm

      Please let me know if you have any questions.

      Comment


        #4
        Hello Patrick,

        thanks for the info on the merge policy, I wasn't aware of this option.
        However since I am interested in the price action of the current contract and the ones following it on the same day, it won't accomplish what I am looking for.

        CalculateOnBarClose = false; is totally fine, tick data is not required, I am happy with this solution.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        646 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        367 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        108 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        570 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        573 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X