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 bowling, Today, 06:16 AM
    1 response
    10 views
    0 likes
    Last Post NinjaTrader_ShawnB  
    Started by systemtrader4, Today, 01:54 AM
    1 response
    15 views
    0 likes
    Last Post NinjaTrader_ShawnB  
    Started by Futurestrader00, Today, 01:54 AM
    1 response
    25 views
    0 likes
    Last Post NinjaTrader_ShawnB  
    Started by timmbbo, Today, 01:40 AM
    2 responses
    10 views
    0 likes
    Last Post NT-Roland  
    Started by BGWTEX, Yesterday, 07:20 PM
    0 responses
    7 views
    0 likes
    Last Post BGWTEX
    by BGWTEX
     
    Working...
    X