Trying to write a simple condition (for alerts, orders, etc) on 5 minutes bars:
I want this condition to only use today's data without premarket. The problem is that the first bar or two of the day can match yesterday's closing bars because of the "within" statement.
Example: Yesterday's close is 11, todays open is 9, still a match at todays open because of the "within". Yesterday's last bar is within 3 bars from open, and 11>10.
In other words, the first bar of the day should not match anything before it, even though it has a "within" statement. The second bar of the day should only evaluate the first and second, etc.
Right now I believe the first bar evaluates the last 3 bars, which includes yesterday's closing bars. If I set the condition to include extended hours, I don't match yesterday's bars, but I do match premarket bars instead, which I also do not want.
Code:
hl2 > 10 within 3 bars
and # more stuff
Example: Yesterday's close is 11, todays open is 9, still a match at todays open because of the "within". Yesterday's last bar is within 3 bars from open, and 11>10.
In other words, the first bar of the day should not match anything before it, even though it has a "within" statement. The second bar of the day should only evaluate the first and second, etc.
Right now I believe the first bar evaluates the last 3 bars, which includes yesterday's closing bars. If I set the condition to include extended hours, I don't match yesterday's bars, but I do match premarket bars instead, which I also do not want.