Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SetStopLoss() question

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

    SetStopLoss() question

    Let's say I call the SetStopLoss() method before submitting an order. The order is filled and the stoploss order is automatically submitted. What if I want to reset that stoploss order to breakeven? When I try to call SetStopLoss() again while the order is active, I get this error:

    10/20/2010 9:34:17 AM Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='ptt Long' Mode=Price Value=697.8 Currency=0 Simulated=False
    10/20/2010 9:34:17 AM Ignored internal SetStopTarget() method: Type=Stop FromEntrySignal='ptt Long' Mode=Price Value=697.8 Currency=0 Simulated=False' Reason='Another SetStopTarget() method call has already submitted a stop/target order'

    Am I not doing it right?

    #2
    Oh, never mind. I figured it out. I have to use the exact same syntax with the SetStopLoss() each time I call it. What I was doing was changing it to the 4-parameter method after the order was filled so that I could tell it what the signalname was. But I guess I have to use the 2-parameter method as I did when it was initially set. It's working now.

    Comment


      #3
      I have another question about the SetStopLoss() method, so I'll just use this thread. If you do this in your strategy:

      SetStopLoss(CalculationMode.Price, Close[0] - (10 * TickSize));

      Is there a property or something I can use to check and tell me what that stoploss price is at any point?

      Thanks!

      Comment


        #4
        Hello cassb,

        Yes, you can expose this. Please see the following reference sample for help with this:
        Monitoring Stop-Loss and Profit Target Orders
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          OK, but that's not what I was looking for. I don't want to manage arraylists of stop and target tokens. I just want to know if there's an existing object that would contain a property or method to tell me what the current SetStopLoss() price value is.

          Comment


            #6
            The reference sample is needed if you want the price of stop loss / targets that are submitted with Set statements.

            As an alternative you can manually calculate it:

            myStopLossPrice = Close[0] - TickSize * 10;
            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              So the answer is 'no', there is no existing property that holds the last value set with a SetStopLoss() method. OK, thanks.

              Comment


                #8
                Yes, there is a property that offers this. The technique needed to access this property is demonstrated in the sample.
                Ryan M.NinjaTrader Customer Service

                Comment


                  #9
                  Oh I see. You mean order.StopPrice and order.LimitPrice? OK, that's what I was looking for, it just has to be done in the OnOrderUpdate() code. Thanks.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by charlesugo_1, 05-26-2026, 05:03 PM
                  0 responses
                  61 views
                  0 likes
                  Last Post charlesugo_1  
                  Started by DannyP96, 05-18-2026, 02:38 PM
                  1 response
                  148 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Started by CarlTrading, 05-11-2026, 05:56 AM
                  0 responses
                  162 views
                  0 likes
                  Last Post CarlTrading  
                  Started by CarlTrading, 05-10-2026, 08:12 PM
                  0 responses
                  98 views
                  0 likes
                  Last Post CarlTrading  
                  Started by Hwop38, 05-04-2026, 07:02 PM
                  0 responses
                  286 views
                  0 likes
                  Last Post Hwop38
                  by Hwop38
                   
                  Working...
                  X