Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Simulator fill issues

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

    Simulator fill issues

    Trying to test a short strategy using Market Replay, but getting strange execution results on NinjaTrader 7. I noticed that GetCurrentBid() gives me 35.50, even though price has moved down to 35.46 (based on OnMarketData). When I tried a market order, it executes at 35.50, when I tried so sell limit order at 35.46, it executes at 35.5, so i figured surely a short stop limit order will do the trick .... guess what. It also executes at 35.5. Here is an extract from the log....

    12/15/2015 11:41:08 PM Order Order='ab34fcae6da540ddafba816debc446e0/Replay101' Name='SL1' New state=Filled Instrument='CL 01-16' Action=SellShort Limit price=35.46 Stop price=35.46 Quantity=1 Type=StopLimit Filled=1 Fill price=35.5 Error=NoError Native error=''

    So what am I missing here? If this was real market data, i.e. there had been prices traded (last) at 36.5, 36.49, 36.48, 36.47 and 36.46 and I executed market or stop limit at 36.46, it would not fill at 36.5!!

    Help please - if this is how the simulator actually works, it is no help at all...

    #2
    Hello us8lander,

    Thank you for your patience.

    Can you provide the Enter methods used (the exact code) so I may investigate this matter further?

    Example: EnterLongLimit(GetCurrentBid(), "entry");

    Comment


      #3
      Code details are as follows:

      bid = GetCurrentBid();
      bestShort = Math.Min(Close[0], bid);
      EnterShortStopLimit(DefaultQuantity, bestShort, bestShort, "SL1");

      I also tried :

      bid = GetCurrentBid();
      bestShort = Math.Min(Close[0], bid);
      EnterShortLimit(DefaultQuantity, bestShort, "S1");

      and EnterShort(...) resulting in a market order. In every cased, the Simulator reported 36.62 fill.

      So in the example I gave you, the last Bid price updated using OnMarketdata() had been at 36.62. The last price (captured by the most recent Close[0]) was 36.60. I did not using OnMarketDepth() to capture the depth of bid information, but I would expect that if I entered short in the 'real market' I would not be filled there ... but at 36.60 or lower.

      BTW - I got an email response from NT_Jesse. Here is his response :
      "
      If the Last trade is reported as 36.60 that would just mean the last traded price was that price, that does not mean the Ask and Bid would be identical or that the market order would fill at that price.
      The outlined events seem correct based on what you have said, I would not expect the Last price to be used in this case if this was a Sell market order. a Sell market order by definition would use the Bid price, if the Bid was being reported as 36.62 at the point where the entry was submitted and there was no slippage the bid would be used.
      Market orders in general can have slippage and I would not expect to always go in at the exact price you had called it at, for more specific prices you would need to use Limit or Stop limit orders depending on the position you are in and what side of the market the order needs to be on.
      You can find more information about the order types and definitions on the publicly available site here: http://www.investopedia.com/university/intro-to-order-types/market-orders.asp"

      Comment


        #4
        Hello us8lander,

        If you are running CalculateOnBarClose = True then Close[0] is the last bar's close. This would explain the difference in price.

        However, it is possible for the Bid and Ask Price to be at a different level than the Last. You may wish to check the Last price in OnMarketData() as well to verify where the current price is.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by kujista, Today, 06:23 AM
        0 responses
        1 view
        0 likes
        Last Post kujista
        by kujista
         
        Started by traderqz, Yesterday, 04:32 PM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by f.saeidi, Today, 05:56 AM
        1 response
        5 views
        0 likes
        Last Post Jltarrau  
        Started by Jltarrau, Today, 05:57 AM
        0 responses
        5 views
        0 likes
        Last Post Jltarrau  
        Started by Stanfillirenfro, Yesterday, 09:19 AM
        7 responses
        53 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Working...
        X