Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Discrepancy between Strategy Analyzer Backtest and Historical Chart Strategy Perform

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

    #16
    Thank you, this is what was causing the candles to have a later date than they should. It was occurring on IWM because this was a ticker symbol I added myself to NinjaTrader because it didn't come pre-set in the software. I didn't assign it a session setting at the time I added it because I didn't know that stuff made a difference. Now I see that all the pre-existing equity ticker symbols have US Equities RTH as their session setting, and they are appearing properly, whereas my manually-added ones were getting Sun 12am to Saturday 12am session and were getting wrong dates...

    There's just one more thing to check and I'll have my answer...

    Ok, I have been able to get the two windows to match finally. It seems to be all related to the sessions of the instruments being traded. In addition to this, like I said I had two bars objects, the second one being the ^SP500 symbol. I was getting incorrect trade executions as long as I had that instrument factored in but when I turned it off both the chart and the strategy analyzer were reacting properly again, and I believe it has something to do with how the ^SP500 session is being treated in these two backtests.

    NinjaTrader_Lance, I'm going to say that you got me to the bottom of this problem and solved it. Now if only I can go dissect that $14,500,000 fluke P&L result and make it happen on purpose

    However, a mystery has arisen, which I will work with on my own from here on but if anyone can pitch in idea about it, I'll be grateful:
    Interestingly, I have the strategy set to use that virtual account balance as mentioned before. It starts with a user-defined amount, default $10,000, and uses that to decide sharesize to purchase. I'm noticing that on the live chart window, every time I disconnect and reconnect from data feed, or reload the strategy, that initial $10,000 amount is being altered in the stratgey parameter window and I have to put it back to $10,000 each time I re-enable the strategy.. didn't expect that to happen.. wonder why. For example, if the 365 days of data loaded produce a loss, pressing refresh multiple times will diminish the strategy's buying power until it can't trade at all anymore over the same time period as it used to do.

    *Edit: I bet I should just put the declaration of it being $10,000 in the initialize portion of my strategy and it will remain as it should upon each refresh.. let's see

    *Edit 2: No, even hard setting the VirtualAccountSize variable I made to $10,000 in the Initialize method does not protect it from being gradually diminished upon multiple chart reloads.. how odd..

    *Edit 3: The variable retains the diminished value even when I shut off ninjatrader 7 completely and restart it - now that was unexpected
    Last edited by RunnrX; 03-05-2013, 11:33 PM.

    Comment


      #17
      One other thing to keep in mind when working with different sessions and instruments. By default if you were to run a strategy from the strategies tab or from a chart with a single data series all session templates would use the parent template. This gets overridden if you add the other data series to a chart with a separate template.

      Copied from the Help Guide:
      If a multi-series script adds an additional Bars object that already exists on the chart, the script will use the preexisting series instead of creating a new one to conserve memory. This includes that series' session template as applied from the chart. If the Bars object does not exist on the chart, the session template of the added Bars object will be the session template of the primary Bars object. If the primary Bars object is using the "<Use instrument settings>" session template then the additional Bars objects will use the default session templates as defined for their particular instruments in the Instrument Manager.

      Originally posted by RunnrX View Post
      Interestingly, I have the strategy set to use that virtual account balance as mentioned before. It starts with a user-defined amount, default $10,000, and uses that to decide sharesize to purchase. I'm noticing that on the live chart window, every time I disconnect and reconnect from data feed, or reload the strategy, that initial $10,000 amount is being altered in the stratgey parameter window and I have to put it back to $10,000 each time I re-enable the strategy.. didn't expect that to happen.. wonder why. For example, if the 365 days of data loaded produce a loss, pressing refresh multiple times will diminish the strategy's buying power until it can't trade at all anymore over the same time period as it used to do.

      *Edit: I bet I should just put the declaration of it being $10,000 in the initialize portion of my strategy and it will remain as it should upon each refresh.. let's see

      *Edit 2: No, even hard setting the VirtualAccountSize variable I made to $10,000 in the Initialize method does not protect it from being gradually diminished upon multiple chart reloads.. how odd..

      *Edit 3: The variable retains the diminished value even when I shut off ninjatrader 7 completely and restart it - now that was unexpected
      This is a known cause when altering the state of a user input value. The value gets changed as your strategy runs and the user input does not get reset when the strategy is stopped.

      You would either have to manually re-type in the user input OR use OnTermination() to reset this value.
      LanceNinjaTrader Customer Service

      Comment


        #18
        Lance you are a hero, and I'm really grateful. You have helped clarify everything I was being bewildered by and everything is now 100% resolved and understood. This is awesome.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        104 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        52 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        34 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        38 views
        0 likes
        Last Post TheRealMorford  
        Started by Mindset, 02-28-2026, 06:16 AM
        0 responses
        74 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Working...
        X