Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Historical bid/ask spread for Tick Replay

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

    Historical bid/ask spread for Tick Replay

    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. AddDataSeries("AAPL", BarsPeriodType.Minute, 30, MarketDataType.Ask);
    from https://ninjatrader.com/support/help...20English.html

    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


    #2
    Hello yubo27,

    Thanks for your post.

    As stated in the help guide link and snippet you shared, TickReplay can only be used to work with MarketDataType.Last, not MarketDataType.Ask or MarketDataType.Bid.

    You could view the BuySellVolume indicator that comes default with NinjaTrader to see how to get the Ask or Bid price from OnMarketData() when MarketDataType == MarketDataType.Last. To view the script, open a New > NinjaScript Editor window, open the Indicators folder, and double-click on the BuySellVolume indicator.

    OnMarketData(): https://ninjatrader.com/support/help...marketdata.htm

    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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    79 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    40 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    63 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    63 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    54 views
    0 likes
    Last Post CarlTrading  
    Working...
    X