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

SetStopLoss in State.Configure or State.DataLoaded?

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

    SetStopLoss in State.Configure or State.DataLoaded?

    Should I place SetStopLoss in State.Configure or State.DataLoaded within OnStateChange()?

    Is there a best practice?

    Thanks,

    Neil

    #2
    I tend to go with State.Configure for static stop loss/take profit strategies. Of course, for more dynamic stop, profit and trailing logic we update those values in onBarUpdate but that's not what you asked. Curious if there's any significant performance benefit between State.Configure and State.DataLoaded as well
    jaybedreamin
    NinjaTrader Ecosystem Vendor - Zion Trading Algos

    Comment


      #3
      Hello Neil,

      Thanks for your post.

      Typically, SetStopLoss() would be called in OnStateChange() when the State == State.Configure.

      The Strategy Builder could be used to set up a stop loss on the Stops and Targets screen of the Strategy Builder and then you could click the 'View code' button to see the generated syntax.

      See the help guide documentation below for more information and sample code.

      SetStopLoss(): https://ninjatrader.com/support/help...etstoploss.htm
      Brandon H.NinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by AaronKoRn, Yesterday, 09:49 PM
      0 responses
      11 views
      0 likes
      Last Post AaronKoRn  
      Started by carnitron, Yesterday, 08:42 PM
      0 responses
      10 views
      0 likes
      Last Post carnitron  
      Started by strategist007, Yesterday, 07:51 PM
      0 responses
      12 views
      0 likes
      Last Post strategist007  
      Started by StockTrader88, 03-06-2021, 08:58 AM
      44 responses
      3,982 views
      3 likes
      Last Post jhudas88  
      Started by rbeckmann05, Yesterday, 06:48 PM
      0 responses
      10 views
      0 likes
      Last Post rbeckmann05  
      Working...
      X