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.
    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by space_trader, 11-26-2020, 05:06 AM
    2 responses
    164 views
    1 like
    Last Post klaus w
    by klaus w
     
    Started by Kicks.Spin, Today, 07:46 AM
    1 response
    3 views
    0 likes
    Last Post NinjaTrader_PaulH  
    Started by Renejm, Today, 06:17 AM
    1 response
    4 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by kazisl, Yesterday, 06:41 PM
    2 responses
    11 views
    0 likes
    Last Post NinjaTrader_PaulH  
    Started by impactX, 05-04-2021, 01:07 AM
    2 responses
    11 views
    0 likes
    Last Post NinjaTrader_Melissa  
    Working...
    X