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

Strategy not starting when enabled

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

    Strategy not starting when enabled

    Hi,

    I created a strategy on Builder and when I enable it, NinjaTrader thinks it is in a position and it doesn't start. How can I fix this?

    Also, is it possible to have a stop and a trailing stop on a strategy created on Builder? I put both but the trailing stop doesn't seems to work on the last tab.

    Thanks

    #2
    Hello sptrader81,

    Thank you for your post.

    When a strategy is enabled, a historical backtest is run to determine if the strategy would have a position at that point in time or not. The default start behavior for a strategy is to wait until the strategy position is flat, and then it will begin submitting live orders to the account the strategy is enabled on. You could set your strategy to only begin its logic in realtime by adding a check to your entry conditions that the Misc > Current State equals Misc > State > Realtime. Another option is to consider using a different start behavior that would allow your strategy to start placing trades to the account right away. More information may be found at the following links:Please let us know if we may be of further assistance.
    Emily C.NinjaTrader Customer Service

    Comment


      #3
      Thanks Emily. Doing this change will affect the Strategy Analyzer results? Also, can you please assist me with the trailing stop question also?

      Is it possible to have a stop and a trailing stop on a strategy created on Builder? I put both but the trailing stop doesn't seems to work on the last tab.​

      Comment


        #4
        Originally posted by sptrader81 View Post
        Thanks Emily. Doing this change will affect the Strategy Analyzer results? Also, can you please assist me with the trailing stop question also?

        Is it possible to have a stop and a trailing stop on a strategy created on Builder? I put both but the trailing stop doesn't seems to work on the last tab.​
        If you change the logic to only run in realtime, there would be no results in the Strategy Analyzer because that uses the Historical state. If you only change the start behavior of the strategy, however, and do not change the logic to only run in realtime, then the Strategy Analyzer results would not be affected.

        My apologies for missing your other question about a stop loss and a trailing stop. No, you may not have both a stop loss and a trailing stop on the Stops and Targets screen. You may only use one or the other, and it is noted in the help guide that these two types of stops may not be combined:With that said, there is a way to generate protective orders that behave like a stop loss using Exit actions in the Conditions and Actions screen instead of using the Stops and Targets screen. This is more of a workaround in the Strategy Builder and it is ultimately more simple to unlock the script and modify your stops and targets in the NinjaScript Editor like this reference sample:


        If you are not comfortable with coding in the editor and prefer to stay in the Strategy Builder, please see the following examples for breakeven and trailing stops used with Exit orders:


        Please let us know if we may be of further assistance.
        Emily C.NinjaTrader Customer Service

        Comment


          #5
          Thanks for your fast response Emily!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by FishTrade, 05-13-2024, 11:11 PM
          3 responses
          12 views
          0 likes
          Last Post FishTrade  
          Started by Graci117, Yesterday, 09:02 PM
          1 response
          12 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by ETFVoyageur, Yesterday, 07:55 PM
          0 responses
          9 views
          0 likes
          Last Post ETFVoyageur  
          Started by janio973, Yesterday, 07:24 PM
          1 response
          7 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by aligator, 01-06-2022, 12:14 PM
          4 responses
          252 views
          0 likes
          Last Post john_44573  
          Working...
          X