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

Multiple invocations of State.Configure per one backtest

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

    Multiple invocations of State.Configure per one backtest

    Documentation declares, that:
    State.Configure = This state is called only once for the life of the object.

    When I Run button in Strategy Analyzer using SampleMACrossOver strategy:
    • then State.Configure is invoked 2x (but expected is only once)


    It is easily reproducible:
    • Just put a debug point on line:50 in file @SampleMACrossOver.cs
    • Run backtest (any settings)
    • and see, you get stopped there 2x with debugger


    Tested it on:
    • NT8 v8.0.2.0
    • Windows 10
    • CQG datafeed (free demo)


    Can you explain, how this can happen?
    My expectation is, that is should be invoked only once per lifetime of the strategy, not 2x as it happens.


    Added later 2016-12-23 13:14):
    • I see, that 2 backtest are run sequentially.
    • You can confirm it, when you add Print(Times[BarsInProgress][0]); into OnBarUpdate().
    • I just clicked Run button once, so I cannot explain, how it is possible, that 2 runs of the same strategy are executed sequentially. You can see evidence in the Output window.If you scroll from start till end, you will see, there are all prints twice, in sequence. It is very strange...
    Last edited by misova; 12-23-2016, 06:20 AM.

    #2
    Hello misova,

    Thank you for your post.

    I am only seeing one print in Configure and the proper increase of Times[BarsInProgress][0] in OnBarUpdate().
    • Are you using multiple time frames in this script as well?
    • Can you attach the script for this test to your response?
    • And are you running a Standard Backtest or an Optimization?

    Comment


      #3
      Hi Patrick,
      • I used standard clean: @SampleMACrossOver.cs (provided by NT8).
      • That also means, there is no additional bars added - just the primary, set in UI.
      • I started common backtest, not an optimization.


      I can reproduce it everytime, systematically.

      Maybe it can be related to this issue
      If analyzer runs multiple times, it could invoke State.Configure multiple times....
      Last edited by misova; 12-23-2016, 09:15 AM.

      Comment


        #4
        On my PC, it is reproducible every time.

        I am attaching the STRATEGY

        This is what is printed in Output window. Clearly, all outputs are doubled.
        DOWNLOAD OUTPUT

        Everything is outputted once, and then again the same = 2x
        Attached Files
        Last edited by misova; 12-23-2016, 09:21 AM.

        Comment


          #5
          As I tested multiple strategies now, I can confirm - IT HAPPENS FOR EACH ONE STRATEGY.

          The general logic is, that COUNT OF RUNS = COUNT OF DATASERIES + 1
          Last edited by misova; 12-24-2016, 05:54 AM.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Kaledus, Today, 01:29 PM
          1 response
          6 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by frankthearm, Yesterday, 09:08 AM
          13 responses
          45 views
          0 likes
          Last Post frankthearm  
          Started by PaulMohn, Today, 12:36 PM
          2 responses
          16 views
          0 likes
          Last Post PaulMohn  
          Started by Conceptzx, 10-11-2022, 06:38 AM
          2 responses
          55 views
          0 likes
          Last Post PhillT
          by PhillT
           
          Started by yertle, Yesterday, 08:38 AM
          8 responses
          37 views
          0 likes
          Last Post ryjoga
          by ryjoga
           
          Working...
          X