Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Current value of a trailing stop

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

    Current value of a trailing stop

    Hello

    I made now several searches in the forum, but could not find an answer to my question.
    I would like to know in my strategy at each BarUpdate() what is the current value of the trailingstop. How can I retrieve that value?

    Thanks
    Andre

    #2
    Andre, how are you setting the trailing stop? With the SetTrailStop() method? If so, you'll have to monitor OnOrderUpdate() for changes to the trailing stop order in a variable and then check that variable every OnBarUpdate(). If you are using IOrders, then you can just check the stop price of the order directly, like this:
    Code:
    // in variables
    private IOrder myOrder = null;
    
    protected override void OnBarUpdate()
    {
        myOrder = ExitLongStop(1300);
        Print("my order stop price: " + myOrder.StopPrice); // will print 1300
    }
    AustinNinjaTrader Customer Service

    Comment


      #3
      I set the trailingstop with SetTrailStop(). Could you please be more specific and make an example how I can check the value?
      I have in my code:
      CurrentOrder=EnterLong(1,EnterOrderName);
      SetTrailStop(EnterOrderName, CalculationMode.Percent ,.05, false);

      Comment


        #4
        Hello Beauregard,

        You can follow the techniques in this sample for tracking prices of orders submitted with Set statements.

        Monitoring Stop-Loss and Profit Target Orders

        The sample is pretty close to what you're looking for, except the name of trail stop orders is different than stop loss.

        For checking trail stop orders:
        if (order.Name == "Trail stop")
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          thanks, this helped

          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