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 kinfxhk, 07-14-2026, 09:39 AM
    0 responses
    10 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-13-2026, 10:18 AM
    0 responses
    59 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-13-2026, 09:50 AM
    0 responses
    41 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-13-2026, 07:21 AM
    0 responses
    47 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-11-2026, 02:11 AM
    0 responses
    38 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Working...
    X