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 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