Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Odd executions when changing market order to limit order

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

    Odd executions when changing market order to limit order

    Hi,

    I and testing different execution orders in my strategy from market orders to limit orders. An example of the code for long orders for market and limit order are below.

    Limit Order
    EnterLongLimit((int)numContracts, GetCurrentBid(), "PRLong");

    Market Order
    EnterLong((int)numContracts,"PRLong");

    The code is exactly the same except for the order types and data on which the strategies are running on are also exactly the same. Hence,the time at which the strategy triggers the order for both should be the same and I would expect the limit order to go through as long as the bar breaches above (for shorts) and below (for longs) the limit price. But the end-result is not what I was expecting.

    I have attached a snapshot of the chart here. The "limit order" strategy missed out on a short trade which was executed by the "market order" strategy at 03:27 AM SGT. Prices have run up thereafter for the next 2 minutes so a short limit order should have been filled isn't it?

    I am baffled by this results. Does anyone encounter the same issue?
    Attached Files

    #2
    Hi lengguan, I would expect differences for those reasons :

    a) limit orders can leave you unfilled
    b) limit orders per default expire at the end of the bar, so if not filled on this very bar > you would not an execution (unless you placed them with the advanced limit order overload and liveUntilCancelled set to true)
    c) you can hit the internal order handling rules in NinjaTrader (from which market orders are exempt) -

    http://www.ninjatrader.com/support/h...d_approach.htm (bottom section here please).

    To understand better what you're running into, please rerun with TraceOrders used as debugging aid.

    BertrandNinjaTrader Customer Service

    Comment


      #3
      Hi Bertrand,

      It shouldn't be (a) or (b) as the limit price of the short order of 1646.75 submitted after close of 3:26 AM bar was touched and breached.

      I thought it might be (c) so I re-run using trace order set to true as you suggested. But the trace file actually outputs the following at the timing where I expect the order to trigger. The rest of the output are the minute bar OHLC data. There wasn't any cancellation of the order or the order being ignored. So the order should get through and be placed at the limit price of 1646.75 since that's where the next bar opens at and in fact proceeded to closed higher. But it didn't both in this simulation run as well as the live run (of which I did not output such data).

      What could be wrong then?

      20130711 32600 1644.75 1647.25 1644.75 1646.75
      11/7/2013 3:26:00 AM Entered internal PlaceOrder() method at 11/7/2013 3:26:00 AM: BarsInProgress=0 Action=SellShort OrderType=Limit Quantity=1 LimitPrice=1646.75 StopPrice=0 SignalName='PRShort' FromEntrySignal=''
      20130711 32700 1646.75 1647 1646.25 1647
      20130711 32800 1647 1647.75 1646.75 1647.5

      Comment


        #4
        lengguan, what not have any idea then from the info provided - would you mind sending me a script I could here potentially our end to further check into?

        It's the same with default or liberal fills, correct?
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Thanks Bertrand. Figured out the cause. The stop orders were in the way. Seems that cancelling the stops solves it.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by cre8able, Today, 03:20 PM
          0 responses
          5 views
          0 likes
          Last Post cre8able  
          Started by Fran888, 02-16-2024, 10:48 AM
          3 responses
          47 views
          0 likes
          Last Post Sam2515
          by Sam2515
           
          Started by martin70, 03-24-2023, 04:58 AM
          15 responses
          114 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by The_Sec, Today, 02:29 PM
          1 response
          7 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by jeronymite, 04-12-2024, 04:26 PM
          2 responses
          31 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Working...
          X