Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to make strategy ready to enter orders at start

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

    How to make strategy ready to enter orders at start

    I have noticed that in my strategy, if I enable the strategy it will show a bunch of simulated historical trades on my chart, right up until the first live bar. If the strategy theoretically would have opened a trade just before the first live bar, then my strategy does not open any trades - it waits fro that simulated trade to close. But that simulated trade never seems to close - even if it hits what would have been my stoploss or take profit, the strategy stays in this untradeable state - not simulated exit ever occurs.

    What I want the strategy to do is ignore any simulated past trades and just start trading from a flat state. I'm sure there is some NT setting to make this happen. Please tell me what to do here.

    #2
    Hello westofpluto,

    Thanks for your post.

    You can "skip" historical processing with if (State == State.Historical) return;

    Reference: (second example): https://ninjatrader.com/support/help...nt8/?state.htm

    If you intend to run your strategy in the strategy analyzer then you would need to comment that line of code out or create a user input bool that you can change when you apply the strategy to enable or disable the use of historical data/trades.

    Comment


      #3
      Paul, is there any way to do this using the Strategy Builder? I like the builder but once the code is unlocked then I can't use it anymore. I tried several things in the builder to say if (State==State.Historical) but no success. State is in the builder menu, but the only options for State on the left side is Historical, Transition, and Real time.
      Suggestions??

      Comment


        #4
        Hello JoeF1953,

        Thanks for your post and welcome to the NinjaTrader forums!

        Yes, you can and you are on the right track!

        In each set, add the condition Misc>Current State equals Misc>state Real Time.

        This condition means that it will only execute the set when the bars are Real time, so there would be no execution on historical bars.

        Comment


          #5
          Wooo - Hooo! Thank you Paul!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NullPointStrategies, Today, 05:17 AM
          0 responses
          46 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          126 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          66 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          42 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          46 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X