Announcement

Collapse
No announcement yet.

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
      <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      77 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      40 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      63 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      63 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      53 views
      0 likes
      Last Post CarlTrading  
      Working...
      X