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

first row of new event

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

    first row of new event

    Hi,

    I assume when the OnMarketData event happens NT runs through every event that is in the cache file.

    So if there are 10 trades you get 10 lines of data to run through.

    If I want to store the duration between events, how can find the first event and store the new tick time?



    Code:
           
     protected override void OnMarketData(MarketDataEventArgs e) 
            {
               // on first event do
               oldtime = now;
                now = DateTime.Now.Ticks;
    Thanks

    Tinkerz

    #2
    Hello tinkerz,

    Thanks for your note.

    The OnMarketData method will run upon receiving any market data such as an ask, bid, last, daily high/low/volume tick is received by NinjaTrader. Receiving a piece of data would be an event.

    Once received the OnMarketData will run with the "e" argument representing the piece of received data. It will run one time for each piece of data received.

    In your inquiry I'm not quite sure what you are asking. If you are asking if OnMarketData will run for the entirety of received data then no it will not do this. If you are asking if OnMarketData runs when an order is placed or receives an update, then no it will not do this either.

    Are you trying to find the amount of time between received pieces of data to get an idea of how quickly data is being received?

    If so, you are on the right track from the code provided. Using two variables to store the new time and old time would give you the time between ticks.

    You will want to create these variables as DateTime variables and use DateTime.Now without the succeeding .Tick.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Stanfillirenfro, Today, 07:23 AM
    8 responses
    23 views
    0 likes
    Last Post Stanfillirenfro  
    Started by DayTradingDEMON, Today, 09:28 AM
    2 responses
    15 views
    0 likes
    Last Post DayTradingDEMON  
    Started by navyguy06, Today, 09:28 AM
    1 response
    6 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by cmtjoancolmenero, Yesterday, 03:58 PM
    8 responses
    32 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by helpwanted, Today, 03:06 AM
    2 responses
    22 views
    0 likes
    Last Post NinjaTrader_LuisH  
    Working...
    X