Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

reseting a setstoploss

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

    reseting a setstoploss

    Hello,
    I'm running into this issue stated in the Help on SetStopLoss:
    "Should you call this method to dynamically change the stop loss price in the strategy OnBarUpdate() method, you should always reset the stop loss price/offset value when your strategy is flat otherwise, the last price/offset value set will be used to generate your stop loss order on your next open position"

    Can someone please give me and idea of how to reset the value. Also there may be times in my strategy when the value will need reset, but I won't be flat, such as having another open position.

    Thanks

    #2
    You will reset the stop by changing stop loss value. An example for this can be found from the following reference:

    http://www.ninjatrader.com/support/f...ead.php?t=3222

    So for example, you could use something like the the following in OnBarUpdate

    if (Position.MarketPosition == MarketPosition.Flat)
    SetStopLoss(CalculationMode.Ticks, 5);

    Please let me know if you have additional questions.
    MatthewNinjaTrader Product Management

    Comment


      #3
      Can I use another condition to reset the value? As I stated before, often my strategy will not be flat.

      Comment


        #4
        Originally posted by CaptainAmericaXX View Post
        Can I use another condition to reset the value? As I stated before, often my strategy will not be flat.
        You can change the StopLoss value at any time, using any trigger condition.

        It is just the you MUST reset the StopLoss when you go flat, or you will see many unintended consequences.

        Comment


          #5
          Thanks for the replies. To be clear must I be FLAT in order to reset the stoploss or can it be reset on another condition?

          Comment


            #6
            Hello,

            You can reset it under any condition, but do make sure you are also resetting when flat to avoid unwanted situations.
            MatthewNinjaTrader Product Management

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            579 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            334 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            101 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            554 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            551 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X