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 NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    62 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    134 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