I'm working off a 2m chart but would like to know when the current 5m bar closes. (00, 05, 10, 15, 20, etc) Problem is that it takes three 2 minute bars to cover one 5 minute bar, essentially a minute late.
More context:
Code:
def bullish_5m_atr_cross = atr_close_5m[2] <= atr_ts_5m[2] and atr_close_5m[1] > atr_ts_5m[1];
In english:
- New bar opens
- One bar ago the close is above ATR Trailing stop
- Two bars ago the close was below ATR Trailing stop
- We have a cross.
On a 2m chart, this condition can be true for up to 3 bars while the 2m chart references the 5m values. I just want to capture the first instance that it becomes true, draw a vertical line and move on. Currently it will draw 3 vertical lines on the 2m chart.
My thinking [could be crazy] is if I can test for the 05, 10, 15, etc. minute, I can draw the line and ignore drawing it if the minute is 02, 04, 06, etc.