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 algospoke, Yesterday, 06:40 PM
        2 responses
        24 views
        0 likes
        Last Post algospoke  
        Started by ghoul, Today, 06:02 PM
        3 responses
        15 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by jeronymite, 04-12-2024, 04:26 PM
        3 responses
        46 views
        0 likes
        Last Post jeronymite  
        Started by Barry Milan, Yesterday, 10:35 PM
        7 responses
        23 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by AttiM, 02-14-2024, 05:20 PM
        10 responses
        181 views
        0 likes
        Last Post jeronymite  
        Working...
        X