• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.


No announcement yet.

Partner 728x90


The Future of Bid and Ask strategy analysis moving forward from RC2

  • Filter
  • Time
  • Show
Clear All
new posts

    The Future of Bid and Ask strategy analysis moving forward from RC2

    Currently RC2 does not take into account a more realistic approach to analyzing Bid and Ask strategies using the functions GetCurrentBid() or GetCurrentBid() , Also known has limit orders. This thread is to help promote fixing the limit order fill engine, to perform to these functions, using the bid ask price settings.

    Feedback are welcomed.

    When an investor places an order to purchase or sell a stock, there are only two fundamental execution options: place the order "at market" or "at limit." Market orders provide instruction to execute, as quickly as possible, a transaction at the present, or market, price. Conversely, a limit order provides instruction to only execute at or under a purchase price or at or above a sales price.

    Limit Orders are extremely important and its analysis. To take into account the nearest ASK and Nearest Bid. In historical the Open[0] is more important then the Close[0] when it comes to limit orders, The BID and ASK is found in level 2 data that is the value the should be used to Fill with out intense custom programming which is now what has to be done to get results.

    Currenty GetCurrentBid() or GetCurrentBid() The main functions for Bid/ASK limit orders, Ninja Trader help states: When accessed during Historical, the Close price of the evaluated bar is substituted.

    Meaning the making money on the current bar is impossible cause you need the previous close, you have to take the trade to next bar which depending on the bar type like 5 bars there is a lost 5 minutes of trading and to any day trader 5 minutes can make the difference of in the money or at a loss.

    This is fundamentally mathematically un-realistic in the case of Limit Orders which deals with Opening price more than closing price.

    I hope we all can contribute to this thread and show how mathematically using the Close of the current bar is totally way off from a realistic approach to limit orders and push by voting here that the next release a fix is added to limited order fills.

    Please share your thoughts.
    Last edited by nettony; 10-21-2016, 01:08 AM.

    Hello nettony,

    Thank you for your post.

    Your notes make sense and truly if possible that is how it would be handled (that being the Bid and Ask Price and not the Last or Close Price). However, what you speak to is Historical bars.

    A Historical bars series is generally the Last Price (excluding Forex where it would be the Bid Price). And more than likely when you set your Bar Series in the Data Series menu you set 'Price based on' to Last or don't change it at all. With all that said a Historical Last Price bar would not have the Bid and Ask Prices within it. So you would think to just add in the Bid and Ask series as they are available however, some Data Providers do not supply Historical Bid and/or Ask data and therefore the information is not present. So what NinjaTrader does is to Simulate Historical Fills as best it can with the data it has.

    Even with that said you still have High Fill Resolution for an option for historical fills. I recommend you look into this based on your inquiry. For information on High Fill Resolution please visit the following link: http://ninjatrader.com/support/helpG...ical_fill_.htm

    You can also find more details on Historical Fills at the following link: http://ninjatrader.com/support/helpG...fill_logic.htm

    Please let me know if you have any questions.
    Patrick H.NinjaTrader Customer Service



      Just to be clear, using the bid/ask data series to fill backtest orders never was a feature of NT8 RC1 or NinjaTrader 7. We don't use bid/ask to fill orders since it has its own set of complications. Typically its harder to get historical bid/ask data and furthermore the quality of bid/ask data is variable from provider to provider since there is no standards as to when a bid/ask value should be recorded. As bid/ask is not like last events where the tape is always updated 'when a trade happens'. Bid / ask historical data could be updated at whatever interval the provider desires which could give you very different result sets from provider to provider.

      Its a gopod idea in principle but it has a lot of challenges involved. Another piece of the puzzle is that we now have bid/ask stamped last events with NinjaTrader 8 for providers that support it (Kinetick/NinjaTrader Continuum). This is a new feature with NinjaTrader 8 and we're still learning all the applications for that. using those values for backtest filling would be something we could look into for a future release and your feedback is received.

      BrettNinjaTrader Product Management


        we now have bid/ask stamped last events with NinjaTrader 8 for providers that support it (Kinetick/NinjaTrader Continuum)
        NT8 is also collecting both Ask and Bid from Interactive Brokers (at least for what I am using which is Forex).
        I would think that any broker that does not provide both Bid and Ask is not worth dealing with.


          Hello Patrick,

          So what NinjaTrader does is to Simulate Historical Fills as best it can with the data it has.
          That is what we want NT8 to do but it does not.
          For example:
          If I have a primary series of daily USDJPY Last. My strategy places market orders on this. In Historic the Fill Engine currently just uses GetOpen(CurrentBar+1) for both Buy and Sell price. But this price will always be the Bid price whereas for a Buy it should be using the equivalent (higher so less favourable) Ask price.
          As a consequence current Backtests tend to show an illusion of more profit (or less loss) than if they had run live.
          Now supposing my broker could not supply an Ask price for the relevant Open then NT would be doing the "best it can" to use the Last.
          But in actual fact the correct Ask price for a Buy is sitting there in Historical Data. So why cant NT just go and get it?
          I'm sure I could write a function say MyGetCurrentDailyAsk() that retrieves from the SQL database under USDJPY/Ask for the relevant date and gets the Open price. There really should not be a problem doing this for Daily and Minute data. Other dataSeries BarsPeriodType might be more problematic (but you can apply the "as best it can" principle).


            Hello Patrick,

            Even with that said you still have High Fill Resolution for an option for historical fills
            This will not help with getting the accurate Bid Ask fill, assuming nettony is using a single (primary) datasource. At least not from my experience with Forex.
            Lets say nettony is using a daily Forex Last series (which is really Bid) and OrderFillResolution.Standard.
            He notices that Sells are filled at the expected Bid price, but Buys are not filled at the expected Ask price (but just use the Bid price also).
            What happens if he turns on High resolution (say Type=Minute, Value=1)? This simply adds another Last series (effectively Bid), and NT doesn't go looking for Ask prices.
            Now if the strategy requests a Market Buy in OnBarUpdate, NT gets the Open for the first Minute bar of the new session. But this is going to be the same as the Open of the next Day bar (when using OrderFillResolution.Standard), since both the primary and secondary are only looking at Bid prices, and in neither case does NT bother seeing if any relevant Ask prices are available.



              Thanks for the feedback.

              We only use the bid/ask for filling Forex orders since bid/ask concept does not work on Futures for various reasons highlighted in this thread. We currently do not use the bid/ask for the fill engine and looking into doing that for futures is something we will add to our list to consider in the future.

              BrettNinjaTrader Product Management


              Latest Posts


              Topics Statistics Last Post
              Started by pulpiwapi, 03-04-2019, 11:18 PM
              11 responses
              Last Post music_p13  
              Started by indy73, Yesterday, 10:52 PM
              3 responses
              Last Post sledge
              by sledge
              Started by priceisking, Today, 12:51 PM
              1 response
              Last Post NinjaTrader_PaulH  
              Started by chartish, Today, 10:33 AM
              3 responses
              Last Post chartish  
              Started by casabella, Today, 11:51 AM
              1 response
              Last Post NinjaTrader_PaulH