I'm trying to create a scan based on an indicator I'm already using. The indicator creates a buy alert when the mark crosses an entry line it generates. This entry line stays active until the mark reaches the stop exit line also generated by the indicator.
I'd like to be able to scan watchlists for stocks that have triggered the alert in the last 15 minute bar, but the scan should not return results if the entry alert was generated in an earlier bar. For example, if the entry line was crossed 4 bars ago and is still active because the position hasn't hit the exit line, the scan shouldn't alert it as a new trigger.
Basically I just want it to alert me with the ticker whenever the entry line is crossed in the most recent bar, but ignore it if the alert already occurred.
I think it has something to do with the double.nan function, but I'm not sure how to implement it.
I'd like to be able to scan watchlists for stocks that have triggered the alert in the last 15 minute bar, but the scan should not return results if the entry alert was generated in an earlier bar. For example, if the entry line was crossed 4 bars ago and is still active because the position hasn't hit the exit line, the scan shouldn't alert it as a new trigger.
Basically I just want it to alert me with the ticker whenever the entry line is crossed in the most recent bar, but ignore it if the alert already occurred.
I think it has something to do with the double.nan function, but I'm not sure how to implement it.