Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 Radano, 06-10-2021, 01:40 AM
    19 responses
    606 views
    0 likes
    Last Post Radano
    by Radano
     
    Started by KenneGaray, Today, 03:48 AM
    0 responses
    4 views
    0 likes
    Last Post KenneGaray  
    Started by thanajo, 05-04-2021, 02:11 AM
    4 responses
    470 views
    0 likes
    Last Post tradingnasdaqprueba  
    Started by aa731, Today, 02:54 AM
    0 responses
    5 views
    0 likes
    Last Post aa731
    by aa731
     
    Started by Christopher_R, Today, 12:29 AM
    0 responses
    11 views
    0 likes
    Last Post Christopher_R  
    Working...
    X