Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Market order when ask/bid is at a set price

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

    Market order when ask/bid is at a set price

    Hello,

    In trying to minimize slippage I am trying to implement a strategy using limit orders. The problem is when placing a limit order my order is placed on the order queue and is not guaranteed to get filled.

    To get around that I would like to be able to place an order that becomes a market order only if the ask/bid is at a price I specify. I realize that is does not quarantees my price but it will get me in very close rather than not at all.

    Is it possible to do this in a NT strategy running on 5 minute charts?

    Also I notice that strategies seem to be able to execute only one order per bar.
    For example the code:

    ExitShort("Short"); // exit short position at market
    EnterLongLimit(Close[0],"Long"); // enter long position at limit price

    will execute the short exit on the next bar and the limit long on the bar after that. I would rather have both orders executed on the same bar.

    Thanks

    #2
    Hello seahn,
    Welcome to the forum and I am happy to assist you.

    Unfortunately Market if touch (MIT) orders are not supported by NinjaTrader. You can however custom code your code to do it.

    Code:
    If (GetCurrentBid() > my price)
    {
        //do something
    }


    How are you submitting the orders. Can it be the case that the Enter() method is being ignored by the strategy as per the orderhandling methods.


    Please append the below code and see if you are able to find out the cause in the output window (Tools>Output window)
    Code:
    TraceOrders = true;
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Thanks for the tip on simulating MIT orders.

      Unfortunately my strategy needs to have the CalculateOnBarClose=true. This is needed to prevent numerous whipsaws if the price ticks back and forth at a price which alternates between long/short entry signals or similar situations.

      Is there a way to have CalculateOnBarClose=false so I can simulate MIT orders and also another method such as a "OnBarClose" or equivalent to actually calculate the strategy entries? I do not see any way of doing this from the available methods.

      Thanks

      Comment


        #4
        Hello seahn,
        Yes, you can do so by using the FirstTickOfBar property. Please refer to this sample code which further discusses it
        JoydeepNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        633 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        364 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        105 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        567 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        568 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X