Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How To Cancel / Remove the Stop Loss setting?

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

    How To Cancel / Remove the Stop Loss setting?

    When SetStopLoss () is first called, it sets an internal value that is used to automatically generate stop loss orders when an order execution is filled. My question is, how do I remove (get rid of) a SetStopLoss setting ? I only use stop losses during certain types of trades, and I do NOT want them used during other trades. I can't seem to find out how to do this very simple thing. Any help will be greatly appreciated.

    #2
    Hello Plan 9,

    Set methods cannot be unset and orders from Set methods are not intended to be cancelled.

    The Set methods are intended to be used and left to manage the order, and it's suggested to use Exit methods (like ExitLongStopMarket()) if you are wanting to have control of cancelling the exit orders.
    https://ninjatrader.com/support/help...stopmarket.htm
    https://ninjatrader.com/support/help...ancelorder.htm
    https://ninjatrader.com/support/help...thod_to_ca.htm

    If a position is closed that initiated a Set method placed order, the Set placed order will automatically be cancelled. So if you call ExitLong() it will cancel any stop loss on that position automatically.
    https://ninjatrader.com/support/help...etstoploss.htm


    Below are links to examples you may find helpful.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      So it sounds like until SetStopLoss( ) is called for the first time, there is none. But once SetStopLoss( ) is called for the first time, you are stuck with it until you restart Ninjatrader, even if the strategy is managing stop losses on its own. It would be nice to have a reset function ResetStopLoss( ) that sets it back to the original OFF state.

      Comment


        #4
        Hello Plan 9,

        Once SetSetLoss() is set, it continues to be set for new orders using that signal name until the strategy is disabled and re-enabled. Use a unique signal name if you don't want a preset set method after it has been called. And there is no reason to restart NinjaTrader.

        Use Exit methods if you want control of cancelling orders.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Thanks. There is one last item that I cannot yet figure out regarding this. When I call SetStopLoss( ), and then open a position with EnterLong( ), the position opens and the stop loss is set. But I can't figure out how to change the stop loss price afterwards. For example, if my original global stop loss is 20 ticks, and after reaching a certain profit I want to change it to breakeven, how would I do it? I tried calling SetStopLoss( ) with the signal for the open position and the new stop price, but it does not seem to have any effect.

          Comment


            #6
            Hello Plan 9,

            Thanks for your reply.

            Here is an example:

            if (your conditions to enter long)
            {
            SetStopLoss(CalculationMode.Ticks, 20); // sets the stop before the entry order
            EnterLong();
            }

            if (Close[0] > Position.AveragePrice + 20 * TickSize) // if the bar close price is greater than 20 ticks above the entry
            {
            SetStopLoss(CalculationMode.Price, Position.Averageprice); // move the stop to breakeven
            }

            Note: Typically in the breakeven, you would also have a bool variable so that you only adjust the order once.
            Paul H.NinjaTrader Customer Service

            Comment


              #7
              Thanks, that led me to a discovery. I was trying to use the second method below, which does not work.

              The first SetStopLoss( ) line below works, the second one doesn't.

              if (entry conditions are true)
              {
              SetStopLoss(CalculationMode.Ticks, 20);
              EnterLong("Long_1"); // entry signal
              }

              if (Close[0] > Position.AveragePrice + 20 * TickSize)
              {
              SetStopLoss(CalculationMode.Price, Position.AveragePrice); // this works
              // SetStopLoss("Long_1", CalculationMode.Price, Position.AveragePrice, false); // this does not work
              }

              So now I can get it to work. Thanks.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by pechtri, 06-22-2023, 02:31 AM
              10 responses
              124 views
              0 likes
              Last Post Leeroy_Jenkins  
              Started by judysamnt7, 03-13-2023, 09:11 AM
              4 responses
              59 views
              0 likes
              Last Post DynamicTest  
              Started by ScottWalsh, Yesterday, 06:52 PM
              4 responses
              36 views
              0 likes
              Last Post ScottWalsh  
              Started by olisav57, Yesterday, 07:39 PM
              0 responses
              7 views
              0 likes
              Last Post olisav57  
              Started by trilliantrader, Yesterday, 03:01 PM
              2 responses
              22 views
              0 likes
              Last Post helpwanted  
              Working...
              X