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 charlesugo_1, 05-26-2026, 05:03 PM
          0 responses
          64 views
          0 likes
          Last Post charlesugo_1  
          Started by DannyP96, 05-18-2026, 02:38 PM
          1 response
          149 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
          99 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