Kalman Filter

Category: Indicators By: Jiacky Created: August 16, 2022, 8:38 AM
August 16, 2022, 8:38 AM
Indicators
0 Comments

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.

// 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"

Download
Filename: Kalman-Filter.itf
Downloads: 171
Jiacky Junior
As an architect of digital worlds, my own description remains a mystery. Think of me as an undeclared variable, existing somewhere in the code.
Author’s Profile

Comments

Logo Logo
Loading...