Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Using Historical Bid/Ask Series without Tick Replay

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

    Using Historical Bid/Ask Series without Tick Replay

    Hi,

    I've been able to access historical bid/ask data by using OnMarketData and TickReplay, however the help guide (https://ninjatrader.com/support/help..._ask_serie.htm) indicates that it should be possible to access via OnBarUpdate() without TickReplay? Please could you let me know if any of the sample strategies are already leveraging historical bid/ask data in this way?

    For additional context:
    To start from, I'm trying to print the Bid & Ask to Output when I load an instrument onto a chart with the strategy enabled. The helpguide shows...

    Code:
    AddDataSeries("AAPL", BarsPeriodType.Minute, 30, MarketDataType.Ask);
    ... however I don't want to hardcode an instrument like "AAPL" and omitting or using 'this" is causing errors (I recognize this is probably a basic thing sorry, but I've been struggling on this for a while now).

    Many thanks

    ChainsawDR

    #2
    Hi ChainsawDR, thanks for posting.

    You can add a 1 tick series and determine a bid or ask update. I attached an example that demonstrates how to do it vs the default "BuySellVolume" which uses OnMarketData/Tick Replay

    Kind regards,
    -ChrisL
    Attached Files

    Comment


      #3
      Wow, thank you very much for putting this together Chris! There's quite a bit for me to pick over here (I've been working on strategies with historical data only so this is the first time seeing how to put together an indicator that works for both). Will loop back if any questions. Thanks again!

      Comment


        #4
        I need to get average bidAsk spread of last 5min for a strategy that's running on TickReplay. (average of 4 ohlc values of last 5min).
        Doc says I cannot get that from series of MarketDataType.Ask​/Bid, from AddDataSeries?

        How can that be done? Can you share a quick snippet? Does one have to manually collects and calculate that from a custom series using OnMarketData?

        What would happen if one tries to access Ask series during tick replay OnBarUpdate?

        Doc:
        https://ninjatrader.com/support/help...ick_replay.htm
        Warning: A Tick Replay indicator or strategy CANNOT use a MarketDataType.Ask or MarketDataType.Bid series.
        Tick Replay was only ONLY designed to work with MarketDataType.Last. A TickReplay indicator or strategy should NOT be mixed with a MarketDataType.Ask or MarketDataType.Bid series




        Last edited by yubo27; 11-12-2022, 08:08 AM.

        Comment


          #5
          Hello yubo27,

          Thanks for your note.

          I see that you created a forum thread asking this same question. Please see the reply to that forum thread linked below.

          I need to get average spread (bid/ask) of last 5min for a strategy that's running on TickReplay. How can that be done? Could share an example snippet? Your doc says following would give past bidAsk, but cannot be used for TickReplay type. What would happen if one tries to access Ask series during tick replay? eg.


          Let me know if I may assist further.
          <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NullPointStrategies, Yesterday, 05:17 AM
          0 responses
          63 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          139 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          75 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          45 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          50 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X