Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

how to create stop loss order in addon?

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

    how to create stop loss order in addon?

    Hi,
    I am using the following to create an order in my addon:
    Order sellOrder = account.CreateOrder(pos.Instrument, OrderAction.Sell, OrderType.Market, OrderEntry.Manual, TimeInForce.Day, 1, 0, 0, null, "SellOrder", Core.Globals.MaxDate, null);

    How can I create a stop market order 10 ticks away from above order?

    I was trying this but I'm not sure how to get the price?

    Order stopOrder = account.CreateOrder(pos.Instrument, OrderAction.BuyToCover, OrderType.StopMarket, OrderEntry.Manual, TimeInForce.Day, 1, ???, 0, null, "StopOrder", Core.Globals.MaxDate, null);

    #2
    Hello trader252,

    To get the orders price you would need to watch for that order to fill and then get its price from the execution. You can watch the order events by using the account variable and its ExecutonUpdate event.

    You could also store the current price at the time of submission to a variable however that would not be accurate to the orders actual fill price.

    You can find a sample of subscribing to the accounts events in the following page: https://ninjatrader.com/support/help...ount_class.htm

    I look forward to being of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CaptainJack, 05-29-2026, 05:09 AM
    0 responses
    310 views
    0 likes
    Last Post CaptainJack  
    Started by CaptainJack, 05-29-2026, 12:02 AM
    0 responses
    200 views
    0 likes
    Last Post CaptainJack  
    Started by charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    186 views
    1 like
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    278 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    229 views
    0 likes
    Last Post CarlTrading  
    Working...
    X