Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CortexZenUSA, Today, 12:53 AM
    0 responses
    1 view
    0 likes
    Last Post CortexZenUSA  
    Started by CortexZenUSA, Today, 12:46 AM
    0 responses
    1 view
    0 likes
    Last Post CortexZenUSA  
    Started by usazencortex, Today, 12:43 AM
    0 responses
    3 views
    0 likes
    Last Post usazencortex  
    Started by sidlercom80, 10-28-2023, 08:49 AM
    168 responses
    2,265 views
    0 likes
    Last Post sidlercom80  
    Started by Barry Milan, Yesterday, 10:35 PM
    3 responses
    11 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Working...
    X