Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Updating create order price

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

    Updating create order price

    Hello,

    I'm using createOrder function to add a stop price and I would like to know how I can update the price of this order.

    Can someone help me ?

    Thx !
    johnok
    NinjaTrader Ecosystem Vendor - Trade With Me

    #2
    Hello johnok,

    Thank you for your post.

    In order to change the price of a stop order you've submitted via Account.CreateOrder() you would need to have saved it in an order variable like in the example seen on the CreateOrder page of the help guide:

    Code:
    Order stopOrder;
    stopOrder = myAccount.CreateOrder(myInstrument, OrderAction.Sell, OrderType.StopMarket, OrderEntry.Automated, TimeInForce.Day, 1, 0, 1400, "myOCO", "stopOrder", Core.Globals.MaxDate, null);
    
    myAccount.Submit(new[] { stopOrder });


    You could then refer to that stopOrder, update its StopPriceChanged property to the price you'd want to change it to, then use Account.Change to change to a new price:

    Code:
    Order stopOrder;
    stopOrder.StopPriceChanged = stopOrder.StopPrice - 4 * stopOrder.Instrument.MasterInstrument.TickSize;
    
    private void OnExecutionUpdate(object sender, ExecutionEventArgs e)
    {
      // Change the stop order if an execution results in a long position
      if(e.MarketPosition == MarketPosition.Long)
          myAccount.Change(new[] { stopOrder });
    }



    Please let us know if we may be of further assistance to you.

    Comment


      #3
      How do you change StopLimitOrder's limit price? Is there a property called StopPriceLimitChanged?

      I want to modify a StopLimitOrder's limit price when it's in Working status.
      Last edited by yubo27; 12-02-2023, 08:39 PM.

      Comment


        #4
        Yes.

        It's called LimitPriceChanged.

        Follow the links that Kate provided above.

        That is, in the Change() page, near the top,
        click on the embedded link for the Order object.

        Comment


          #5
          Hello yubo27,

          Thanks for your notes.

          bltdavid has provided some great information on this topic.

          Please see NinjaTrader_Kate's sample code on post # 2 demonstrating how to change the price of a stop order and see the help guide links shared in post # 2.
          <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          574 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          333 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
          553 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          551 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X