Exponential Volatility Bands

Category: Indicators By: xel Created: July 17, 2017, 7:34 PM
July 17, 2017, 7:34 PM
Indicators
0 Comments

Same principle as famous “Bollinger Bands” but with REAL EXPONENTIALY WEIGHTED STANDARD DEVIATION algorithm as band multiplier from an EMA mid.

// ELSASTIC WEIGHTED MOVING AVERAGE
PRICE  = LOG(customclose)
alpha  = 2/(PERIODS+1)
// EWMA (EMA)
if barindex < PERIODS then
 EWMA = AVERAGE[3](PRICE)
else
 EWMA = alpha * PRICE + (1-alpha)*EWMA
endif
// ELASTIC WEIGHTED STANDARD DEVIATION (ESD)
error = PRICE - EWMA
dev   = SQUARE(error)
if barindex < PERIODS+1 then
 var  = dev
else
 var   = alpha * dev + (1-alpha) * var
endif
ESD   = SQRT(var)
// BANDSSAverage[20](close)
// BANDS
UB = EXP(EWMA + (DEVIATIONS*ESD))
BB = EXP(EWMA - (DEVIATIONS*ESD))
MID = EXP(EWMA)

RETURN MID as "EWMA(EMA)", UB as "+ESD", BB as "-ESD"

Download
Filename: ewmaBANDS.itf
Downloads: 214
xel Average
Mexico, US Stock Momentum Trader.
Author’s Profile

Comments

Logo Logo
Loading...