Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Rolling time-based window

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

    Rolling time-based window

    Hello,

    This is my first post in here, so please be gentle. I'm new to NT and come to it from a Python coding background.

    I've got a fairly simple requirement (I think) but am stumped by my current lack of C# experience; am sure some of you more experienced guys and gals will have no problem pointing me in the right direction.

    I'm using OnMarketData() so that I can capture each update of the level 1 data as it is streamed live. I would like to capture a rolling X minute window of these bid and ask updates, and then perform some calculations on this window of data.

    In Python I would construct a timestamp-indexed pandas dataframe for this job. I'd then contribute the incoming bid and ask updates to this dataframe. I could then timeslice the dataframe using something like:

    [ (timestampOfLastTick - X minutes) : timestampOfLastTick]

    to get my X-minute window and then perform the calculations I need before the next tick update comes in from OnMarketData()

    What is the equivalent and correct way to approach this in NT and C# ?

    Thanks in advance for your thoughts.

    AhabMD

    #2
    Hello,

    Thank you for your post and welcome to our forums!

    This topic goes a bit out of the realm of what we can support as it is more of general C# inquiry therefore we wouldn't have any reference samples off hand (perhaps someone will post a working example of something you can reference)

    If you just need to make a time comparison, you can use a TimeSpan:



    If you actually need a way to store and loop through an array which contains that information, you'd need to create some sort of custom list or dictionary and store all of those values in some sort of struct, class or array (depending on your requirements). I'm including some 3rd party links which may help you here:


    MatthewNinjaTrader Product Management

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    630 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    364 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    105 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    566 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    568 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X