Indicator Kalman Filter. It allows efficiently smoothing the noise, extracting the main trend from it.
This code is extracted from Average Filter Regression by laurenzo in PRC library and given signal according to the velocity. Go long if the velocity is above 0. Go short if the velocity is below 0.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
// K = 500 ({1...2000}) Series = TotalPrice ONCE Pred = Series IF BarIndex = 0 THEN KF = Series ELSE Smooth = Pred + (Series - Pred) * SQRT((K / 10000) * 2) Velo = Velo + ((K / 10000) * (Series - Pred)) Pred = Smooth + Velo KF = Pred ENDIF if velo > 0 then g = 255 r = 0 else g=0 r=255 endif RETURN KF coloured(r,g,0) as "Kalman Filter" style (DOTTEDLINE4,3), Velo as "Velocity" |
Share this
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.
ProRealTime ITF files and other attachments :
Filename : download the ITF files
How to import ITF files into ProRealTime platform?
PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials