The current contents (might be expanded in the near future):
- TimeInterval.Minutes(BarsBack_Oldest, BarsBack_Newest): calculates the time interval in total number of minutes between the bars back (relative to the current bar).
- TimeInterval.MinutesAbs(BarsBackFirst, BarsBackSecond): calculates the time interval in the absolute number of minutes between both (relative to the current bar).
- TimeSince.Minutes(BarsBack): returns the time interval in minutes of the current computer time minus the time of a bar a certain 'BarsBack' back. Note that this is affected by time zone difference between your trading chart and your computer time.
Code: Select all
once (LastBarOnChart_s = true) begin
// Time interval between current bar (0) and four bars back
Print("Prev: ", FormatTime("HH:mm:ss", DateTime[4]));
Print("Current: ", FormatTime("HH:mm:ss", DateTime));
Print("Minutes: ", TimeInterval.Minutes(4, 0), NewLine);
// Absolute time interval between previous bar and
// bar 12 bars back
Print("Prev: ", FormatTime("HH:mm:ss", DateTime[12]));
Print("Current: ", FormatTime("HH:mm:ss", DateTime[1]));
Print("Minutes: ", TimeInterval.MinutesAbs(1, 12), NewLine);
// Time interval between the bar 8 bars back and the
// current pc time (affected by time zone difference of pc and chart!)
Print("Prev: ", FormatTime("HH:mm:ss", DateTime[8]));
Print("Current: ", FormatTime("HH:mm:ss", ComputerDateTime));
Print("Minutes: ", TimeSince.Minutes(8), NewLine);
end;
Code: Select all
Prev: 11:35:00
Current: 13:35:00
Minutes: 120.00
Prev: 07:35:00
Current: 13:05:00
Minutes: 330.00
Prev: 09:35:00
Current: 13:08:57
Minutes: 213.96