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 CarlTrading, 03-31-2026, 09:41 PM
          1 response
          63 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 04-01-2026, 02:41 AM
          0 responses
          35 views
          0 likes
          Last Post CarlTrading  
          Started by CaptainJack, 03-31-2026, 11:44 PM
          0 responses
          54 views
          1 like
          Last Post CaptainJack  
          Started by CarlTrading, 03-30-2026, 11:51 AM
          0 responses
          61 views
          0 likes
          Last Post CarlTrading  
          Started by CarlTrading, 03-30-2026, 11:48 AM
          0 responses
          48 views
          0 likes
          Last Post CarlTrading  
          Working...
          X