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 Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  637 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  366 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  107 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  569 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  572 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X