Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Breakeven Stop Loss Not Working

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

    Breakeven Stop Loss Not Working

    Hi,

    I am trying to code a strategy that exits based on time since entry so there is no initial stop loss created when the entry takes place. However, I am now trying to test adding a breakeven stop loss once the trade gets to a certain number of points in profit. I am having an issue with my SetStopLoss for this breakeven SL on some trades because it causes for the trade to immediately exit after entry is taken. It seems that on some of the trades the SetStopLoss order is being placed immediately rather than waiting for the trade to hit a certain number of points in profit. I've tried adding conditions such as BarsSinceEntry to prevent this immediate SetStopLoss order but the if statement is completely ignored and the SetStopLoss order gets submitted anyways. Does anyone know what the issue is and how I can fix it?

    Thank you!

    #2
    Here is the code for what I'm describing
    Attached Files

    Comment


      #3
      Here is a quick soft answer because the support staff is off duty for the weekend.

      I have never used "Set" methods but somehow would not have chosen that approach to achieve your goals.

      Have a look at the other Managed Order Types. https://ninjatrader.com/support/help...ng_changes.htm

      Like these ..







      You can submit these these any time you want once the orders are open.

      Hedge

      Comment


        #4
        Yea I've thought about doing that but I really want to try to figure out why this issue is happening so I can prevent it in the future. Thank you for the information/links though!

        Comment


          #5
          Hello rjm1903,

          Set methods, like SetStopLoss(), are intended to be submitted immediately when the entry order fills and once set for a signal name cannot be unset.

          Use Exit orders instead and submit these based on your criteria.

          Below is a link to an example of a breakeven created with the Strategy Builder you may find helpful.
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            Thank you for the response! Why does it seem that the SetStopLoss works in some instances when it isn't immediately set at entry time? But then other times it causes this issue of immediately exiting the trade?

            Comment


              #7
              Hello rjm1903,

              After the set method is called it is set for any new orders. The first order may be before the set method has been set.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Yea but in my backtest the breakeven stop loss function using SetStopLoss works for several trades before it starts giving the issue of immediate exit after entry. So that's why I'm confused that it works properly sometimes but then it just randomly stops functioning as expected.

                Comment


                  #9
                  Hello rjm1903,

                  Even in backtest Set methods cannot be unset and will continue to be set for new entries using the same signal name.

                  It may be the price of the stop was reached in the submission bar to fill.

                  That said, using Exit orders should resolve the behavior.
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #10
                    Ok thank you very much I will switch to Exit orders

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by NullPointStrategies, Today, 05:17 AM
                    0 responses
                    38 views
                    0 likes
                    Last Post NullPointStrategies  
                    Started by argusthome, 03-08-2026, 10:06 AM
                    0 responses
                    124 views
                    0 likes
                    Last Post argusthome  
                    Started by NabilKhattabi, 03-06-2026, 11:18 AM
                    0 responses
                    64 views
                    0 likes
                    Last Post NabilKhattabi  
                    Started by Deep42, 03-06-2026, 12:28 AM
                    0 responses
                    41 views
                    0 likes
                    Last Post Deep42
                    by Deep42
                     
                    Started by TheRealMorford, 03-05-2026, 06:15 PM
                    0 responses
                    46 views
                    0 likes
                    Last Post TheRealMorford  
                    Working...
                    X