The code looks like this:
study(title = "Hull MA", shorttitle="HMA", overlay = true, resolution="60")
length = input(48, minval=1)
price = input(close, title="Source")
hull = wma(2*wma(price, length/2)-wma(price, length), round(sqrt(length)))
plot(hull, title='Hull', color=change(hull) < 0 ? color.orange : color.purple, linewidth=2, transp=0)
So, what I would like to be able to do is send a BUY-signal when Hull turns purple and a SELL-signal when Hull turns orange. I thought I could do it by adding this:
plotshape(change(hull) < 0, color=color.orange, style=shape.circle, location=location.belowbar, text="sell", title='sell')
plotshape(change(hull) > 0, color=color.purple, style=shape.circle, location=location.abovebar, text="buy", title='buy')
But if I do it like that, I get a BUY-signal on every candle where hull > 0 and a SELL-signal on every candle where hull < 0 (I'm running this on an 8h-candle with a resolution of 1h for the HullMA). I just want 1 BUY-signal when the plot turns from Orange to Purple and 1 SELL-signal when the plot turns from Purple to Orange.
Anyone have any ideas? I'd be much obliged! :)