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 Mindset, 04-21-2026, 06:46 AM
      0 responses
      90 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      137 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      68 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      120 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      72 views
      0 likes
      Last Post PaulMohn  
      Working...
      X