Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

stopOrder.StopPrice

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

    stopOrder.StopPrice

    I am trying to pickup the value of StopPrice

    Apparently I am not using stopOrder.StopPrice properly...i.e. you can use it like this

    if (stopOrder != null && stopOrder.StopPrice > Position.AvgPrice)

    however can not use it in a print statement nor assign its value to a variable

    is it possible to access this value...if not now, NT7?

    ideally, I want to be able to plot the value of the trailing stop from SetTrailStop

    since the value can be used in logic/if statements and it is printed in the Log, why is it not available from code

    thanks.

    #2
    Originally posted by ATI user View Post
    I am trying to pickup the value of StopPrice

    Apparently I am not using stopOrder.StopPrice properly...i.e. you can use it like this

    if (stopOrder != null && stopOrder.StopPrice > Position.AvgPrice)

    however can not use it in a print statement nor assign its value to a variable

    is it possible to access this value...if not now, NT7?

    ideally, I want to be able to plot the value of the trailing stop from SetTrailStop

    since the value can be used in logic/if statements and it is printed in the Log, why is it not available from code

    thanks.
    Have you checked out this reference sample? I am quite sure you can access the stop price...

    RayNinjaTrader Customer Service

    Comment


      #3
      yes...I had...and immediately forgot about it...tried another way which did not work (also does not work if you use AtmStrategyCreate code instead)

      thanks

      here is the code for others:


      protected override void OnOrderUpdate(IOrder order)
      {

      // Process stop loss orders
      if (stopLossTokens.Contains(order.Token))
      {
      // Check order for terminal state
      if (order.OrderState == OrderState.Cancelled || order.OrderState == OrderState.Filled || order.OrderState == OrderState.Rejected)
      {
      // Print out information about the order
      Print(order.ToString());

      // Remove from collection
      stopLossTokens.Remove(order.Token);
      }

      // Print out the current stop loss price
      else
      Print("The order name " + order.Name + " stop price is currently " + order.StopPrice);
      }

      Comment


        #4
        ATM generated orders will NOT trigger OnOrderUpdate() in a NinjaScript strategy.
        RayNinjaTrader Customer Service

        Comment


          #5
          right..thanks....

          that is one of the reasons I am switching away from ATM code

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          558 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          324 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          101 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          545 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          547 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X