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

Submitted market and stop order simultaneously

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

    Submitted market and stop order simultaneously

    Hello NinjaTrader,

    I have a question about creating a market order with a stop order in
    NinjaScript, when connecting to MBTrading.
    In the MBTrader API, the method to do this is:
    MbtOrderClient.Submit(iBuySell VALUE_BUY, iOrderType VALUE_MARKET, double
    dStopPrice, ...)
    I changed the form of this method a little to make the point that the call
    allows the market order to be submitted with the stop price. I like this
    because it doesn't throw the ball back into my court to create a stop order
    after the market order is filled. Then I don't have to worry about runaway
    orders, particularly if the connection is lost between the time the market
    order was created and the stop created.
    I would like to code my NinjaScript order entry to take advantage of that
    Submit call.
    I understand that in the Managed approach, the SetStopLoss method sets the
    stop loss, but that the actual order is not submitted until the entry order
    executes.
    In the Unmanaged approach, the process is the same, except that the programmer
    explicity creates the stop order during the OnExecution response to create the
    market order.
    If I have my facts right so far, could I ask: is there a way to program my
    NinjaScript to have it call the Submit at the MBT layer, with both the market
    price and the stop?

    Thanks for the help, Brian Warren

    #2
    Hello,

    Thanks for the note.

    Unfortunately this is not possible in NinjaTrader with NinjaScript as this requires direct access to the MBT API which is at this time not provided and this is not a feature of MBT that we currently support. Along with MBT TTO order type we currently do not support.

    Do you use a stop loss and a profit target by any chance and are you trading equities?

    Thanks.

    Comment


      #3
      Hi Brett,

      Thanks for the letting me know. Yes, you are correct, I am trading with a stop loss and profit target. My instruments are all futures.

      Thanks, Brian

      Comment


        #4
        If your trading futures then your all good. Just wanted to double check. There is a limitation on this with equities so if you run this on equities or plan to let me know so I can get you detailed on that limitation.

        Thanks.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Shai Samuel, 05-02-2023, 01:32 AM
        8 responses
        126 views
        0 likes
        Last Post giulyko00  
        Started by suraj, 05-18-2024, 08:51 AM
        3 responses
        19 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by sylviannyc, Today, 09:07 AM
        0 responses
        3 views
        0 likes
        Last Post sylviannyc  
        Started by kaywai, Today, 07:09 AM
        3 responses
        10 views
        0 likes
        Last Post NinjaTrader_ChristopherJ  
        Started by Human#102, Today, 05:18 AM
        3 responses
        16 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Working...
        X