Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Time/Date Stamp of Firstbar loaded

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

    Time/Date Stamp of Firstbar loaded

    Hello There

    I seem to be using alot if time troubleshooting missing data errors. because i run in differant time frames,
    bars required on a 30 sec series would be alot higher than on a daily series.


    Instead of defining Bars required in numbers of bars the traditinal way i want to define it in a matter of hours.
    how can i get the time / data stamp of the first bar recieved ?

    I will then check that with the current bar and check i always have atleast for an example 48 hours in between.

    I was hoping to do something like this but cant seem to get it working.

    if (Time[CurrentBars[0]].AddHours(48) >= Time[b])
    return;​
    Last edited by donto; 12-21-2024, 03:49 AM.
    Donto
    NinjaTrader Ecosystem Vendor - otrading.dk

    #2
    Maybe use:

    if(CurrentBar == 1)
    .....



    and also do a forum search for "IsFirstBarOfSession" , which may be of use...

    Comment


      #3
      Hello donto,

      Time[CurrentBars[0]] would provide the time of the first bar of the primary series.

      I would recommend using prints to understand the behavior.


      Print(string.Format("{0} | BarsInProgress: {1} | Time[CurrentBars[0]: {2}]: {3} .AddHours(48): {4} => Time[b: {5}]: {6}", Time[0], BarsInProgress, Time[CurrentBars[0]], Time[CurrentBars[0]].AddHours(48), b, Time[b]));

      You can use Bars.GetBar() to get a bar with an absolute index for a given datetime, and subtract this from CurrentBar for a barsAgo index.
      Chelsea B.NinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Yesterday, 05:17 AM
      0 responses
      59 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      134 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      75 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      45 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      50 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X