Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

BackTest MinBarsRequired conceptual question

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

    BackTest MinBarsRequired conceptual question

    Hello,

    I want to backtest my strategy for single day, let's do 2jan2009.

    I need BarsBackRequired=200;


    So I start the StrategyAnalyzer , run it and debug, and in

    OnBarUpdate() the first call arrives not at market open of the day , but the first call is 200 bars later.

    Is there a possibility to run the BackTest also starting from mar****pen directly and not 200 bars later?

    A simple fix would be to define the start date of the strategy 200 bars earlier, but 200 bars earliers is not a constant timespan, because there can be weekends, trading holidays , daylight saving time etc. in between.

    So there is no easy way to find the exact timespan for 200 bars before.

    The best would be if the strategy could just start on the datetime defined as SessionBegin and at the same time have also 200 bars more in the Bars object.

    Any idea on how to setup a strategy in this way?

    Andreas

    #2
    Andreas,

    That would not be the usage model for the strategies. I suggest you just load a date further back that is guaranteed to contain your 200 bars and then simply filter your strategy to not process anything until your desired date and time through a time filter if-condition.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Josh,


      thank you for the advice. In my case that would imply an additional property in my strategies that just serves that purpose of backtesting.
      ... and I like small and concise code...

      Regards

      Comment


        #4
        Unfortunately that simply is not the usage model for that property.
        Josh P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        144 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        71 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        125 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        79 views
        0 likes
        Last Post PaulMohn  
        Working...
        X