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

During replay, strategy always starts with a position

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

    During replay, strategy always starts with a position

    Hello,

    I was testing a strategy in real-time using Market Replay. I had no issues applying the strategy, running playback, observing, stopping playback, making modifications to strategy code, resetting the playback time (moving the slider, which resets the strategy as well), and continuing to test.

    However, at some point along the way, it got out of whack. Now every time I enable the strategy, it immediately shows as being in a position, even before starting the market replay. The Playback101 account has no positions in it, nothing in the DOM, Sync status in the strategy pane also shows true.

    I have tried the following with no success:
    - reverting code to a state where it worked perfectly before
    - saving strategy as a different name, re-compiling, and applying to chart
    - deleting the market replay data and re-downloading (using a few different days also)
    - removing the strategy from the chart, and also making sure it was removed from the main strategy pane, then adding it back
    - deleting the cache folder from the Documents > Ninja Trader 8 > db directory (saw this mentioned in another post, so thought I would try it)
    - Close the workspace I was in, and attempting in another workspace
    - used a completely different strategy (built with strategy builder), and it started with a position as well (same symptoms)
    - Restart NT8
    - Update NT8 (from 8.0.26 to 8.0.26.1)

    It doesn't make much sense to me why it was working fine before, and now it won't work at all. Perhaps there is some other cache causing the problem, but I really don't know. Very frustrating indeed. Any help would be much appreciated.

    -Chris
    Last edited by risteon; 06-11-2022, 06:25 PM.

    #2
    Hello risteon,

    The playback starts in realtime when the live data starts playing, if the strategy is applied to a chart with historical data on it then it will still do a historical backtest which may result in a virtual strategy position. The strategy would need to be flat to start working in realtime using the default start behavior of wait until flat.

    The place in time you start will affect if the strategy enters a position or not before you have realtime data playing, if the point in time you select results in a historical position you would need to either adjust the time so that does no happen or make the strategy work only in realtime to avoid using historical orders

    You can confirm this is happening when playing forward by looking in the control center strategies tab to check if its color is yellow/orange to mean that it is waiting to exit a historical position.





    .

    JesseNinjaTrader Customer Service

    Comment


      #3
      Hi Jesse,

      I do recall seeing the strategy name was colored yellow. Thanks for the info regarding the historical aspect. I will test further and reply back if I still have issues.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Jonafare, 12-06-2012, 03:48 PM
      5 responses
      3,984 views
      0 likes
      Last Post rene69851  
      Started by Fitspressorest, Today, 01:38 PM
      0 responses
      2 views
      0 likes
      Last Post Fitspressorest  
      Started by Jonker, Today, 01:19 PM
      0 responses
      2 views
      0 likes
      Last Post Jonker
      by Jonker
       
      Started by futtrader, Today, 01:16 PM
      0 responses
      7 views
      0 likes
      Last Post futtrader  
      Started by Segwin, 05-07-2018, 02:15 PM
      14 responses
      1,791 views
      0 likes
      Last Post aligator  
      Working...
      X