Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Getting value when using SetStopLoss()

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

    Getting value when using SetStopLoss()

    How can I retrieve the value/price when using SetStopLoss?

    // Check if Stop has Not been moved to breakevven
    if(Math.Abs(Position.AveragePrice - SetStopLoss.Value) > TickSize)
    {
    // Move Stop to Breakeven
    }

    #2
    Hello TAJTrades,

    With the Set methods there are two ways to do that. The first is if you are setting a specific price, in that case you should have a variable with the price that can be referenced. The other way is to use OnOrderUpdate to find the order and then get its price. We have a sample that shows how to find a stop loss in the following page, the same concept would apply with your script as you would need to locate the order and save it to a variable. Later you could reference that variable in your condition in place of "SetStopLoss.Value".

    https://ninjatrader.com/support/help..._and_profi.htm
    You don't need the lists from this sample, mainly just the part where it finds the order by name: if (order.Name == "Stop loss")

    You can make a variable with the order:

    Code:
    private Order myStop;
    that would get assigned from OnOrderUpdate:
    Code:
    if (order.Name == "Stop loss")
    {
        myStop = order;
    }

    Then you can use the myStop.StopPrice to get its stop price. https://ninjatrader.com/support/help.../nt8/order.htm




    I look forward to being of further assistance.

    Comment


      #3
      Thanks Jesse.

      Am doing some speed testing for a scalping system where speed is the priority. I have already done the variable with price for tracking you suggested and also a bool flag IsPriceSetToBreakeven.

      I overlooked the OnOrderUpdate method for Managed Approach so will give that try and see which is fastest..

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Today, 05:17 AM
      0 responses
      48 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      126 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      66 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      42 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      46 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X