Trying to code the below strategy but alert happened only once for the script even though condition met multiple times.
I wanted to generate a buy alert signal whenever the last traded price equaled the High price of the day or exceeded it. Also, wanted a sell Alert signal whenever the last traded price equaled the low price of the day or went less than that.
My Buy Script: REF(LAST,0) = REF(HIGH,0) OR REF(LAST,0) > REF(HIGH,0)
My Sell Script: REF(LAST,0) = REF(LOW,0) OR REF(LAST,0) < REF(HIGH,0)
The problem is that the buy alert was generated only once when the LTP equaled High price. After that, whenever the LTP became equal to the High price, no buy alert was generated. Why the Alert signal generated only once when the condition was met for the first time and after that? The buy alert should have triggered every time this condition is met but it did not. Will the second buy alert be generated only after the first buy alert is squared off? Is it because of this that subsequent buy alert signals were not generated?
I’d appreciate it if someone helped me with this. Thank you.
PS: I was using the day chart with 1 day interval. So the codition would check only the most recent candle which happens to be the intraday/current bar.