• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Historical Execution

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

    Strategy Historical Execution

    Forgive me for what I'm sure is a completely novice question, but I've been unable to find any information about this. When a strategy is enabled, why does it run retroactively through historical data first? As in, when I enable a strategy it appears to run through some number (I'm not sure how many) of bars on the chart before reaching the current "present" bar. Is there any way to disable this behavior?

    This causes problems because now all of my variables have been affected by historical data. For example, I have a variable that tracks my PnL and this causes it to have a value based on historical data, when it should be starting at 0. Now my strategy PnL is different from my account PnL. This is just one example, but it would be great if this could be disabled somehow.

    #2
    Hello,

    Thank you for the post.

    This is simply how the platform works, bars are evaluated from left to right starting at bar 0 in historical data. If you load X amount of data, all of that data would be processed. In the case you want to omit historical data from being used, you can.

    If you are manually coding, you would just need to check that the state is not equal to Historical:

    Code:
    protected override OnBarUpdate()
    {
       if(State == State.Historical) return;
    You can also do this using the Builder, in your conditions you can check Misc -> CurrentState != Misc -> State.Historical

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Fantastic, that's exactly what I needed.

      Thanks!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Velhinho, Today, 12:30 PM
      1 response
      5 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by EF Hutton, Today, 12:36 PM
      1 response
      6 views
      0 likes
      Last Post NinjaTrader_Melissa  
      Started by TraderIqbal, Today, 11:17 AM
      1 response
      6 views
      0 likes
      Last Post NinjaTrader_PatrickG  
      Started by frankduc, Today, 11:42 AM
      3 responses
      11 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by bdelorm, Today, 11:10 AM
      1 response
      4 views
      0 likes
      Last Post NinjaTrader_PatrickG  
      Working...
      X