The Kahlman smoother makes the signal more precise (by one candle).
alertcondition(crossup, title='Buy', message='go long')
alertcondition(crossdn, title='Sell', message='go short')
For starters you can try these:
- this one should be adjusted to avoid repainting: change current hlc3 value to the previous hlc3 value in security func.
gain = input(.5, "Gain", step=.01)
kahlman(x, g) =>
kf = 0.0
dk = x - nz(kf, x)
smooth = nz(kf,x)+dk*sqrt(g*2)
velo = 0.0
velo := nz(velo,0) + (g*dk)
kf := smooth+velo