Bar reference
The 2 functions and 13 values of bar: signature, effects, phase, cost and tested examples.
Tests on the time of the current bar against a session, and the values of the bar: its number, its times and where it stands in the history.
Functions#
bar.close_time_in#
bar.close_time_in([tf], [session], [zone], [offset])
The time at which the bar (or the period of tf it belongs to) closes, when the bar lies inside the session text in the zone; na outside it.
- Effects: none: the result depends on the arguments only.
- Phase: every bar.
- Cost: a fixed number of operations.
- Examples: Window of the day.
bar.time_in#
bar.time_in([tf], [session], [zone], [offset])
The time at which the bar (or the period of tf it belongs to) opens, when the bar lies inside the session text in the zone; na outside it.
- Effects: none: the result depends on the arguments only.
- Phase: every bar.
- Cost: a fixed number of operations.
- Examples: Window of the day.
Values#
bar.close_time— The time the bar closes.bar.index— The number of the bar, counting from 0 at the oldest bar.bar.is_closed— True when the bar has closed.bar.is_first— True on the oldest bar.bar.is_first_of_daybar.is_history— True on bars of the past.bar.is_last— True on the newest bar.bar.is_last_historybar.is_last_of_daybar.is_live— True while the newest bar is still forming.bar.last_indexbar.last_timebar.time— The time the bar opened.