Comment on Managing your Script
The code you have suggested, gives trigger only when current candle closes above the previous candle high.
My strategy is different:
It should trigger when current price goes above high of previous candle and this previous candle should have closed above the high of earlier candle.