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