Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnMarketData on Historical data

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

    OnMarketData on Historical data

    Hi,

    I wish to run OnMarketData on Historical data, please tell me how do I take the example in the guide and run it on historical data:

    protected override void OnMarketData(MarketDataEventArgs marketDataUpdate)
    {
    // Print some data to the Output window
    if (marketDataUpdate.MarketDataType == MarketDataType.Last)
    Print(string.Format("Last = {0} {1} ", marketDataUpdate.Price, marketDataUpdate.Volume));
    else if (marketDataUpdate.MarketDataType == MarketDataType.Ask)
    Print(string.Format("Ask = {0} {1} ", marketDataUpdate.Price, marketDataUpdate.Volume));
    else if (marketDataUpdate.MarketDataType == MarketDataType.Bid)
    Print(string.Format("Bid = {0} {1}", marketDataUpdate.Price, marketDataUpdate.Volume));
    }

    Thank you.

    #2
    Hello,

    Thank you for the post.

    To use OnMarketData historically, you would first need to enable TickReplay and ensure you have tick replay data for the instrument being used. Once this is done, the override can be used historically.

    We have a help guide article on this specific topic here: https://ninjatrader.com/support/help...sub=tickreplay

    Please ensure to utilize the example that is specific to TickReplay from the above link, the syntax to use TickReplay is different than the syntax you have posted which would be used for Realtime.

    I look forward to being of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by SalmaTrader, 07-07-2026, 10:26 PM
    0 responses
    31 views
    0 likes
    Last Post SalmaTrader  
    Started by CarlTrading, 07-05-2026, 01:16 PM
    0 responses
    18 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 06-17-2026, 10:32 AM
    0 responses
    9 views
    0 likes
    Last Post CaptainJack  
    Started by kinfxhk, 06-17-2026, 04:15 AM
    0 responses
    16 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 06-17-2026, 04:06 AM
    0 responses
    20 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Working...
    X