Same principle as famous “Bollinger Bands” but with REAL EXPONENTIALY WEIGHTED STANDARD DEVIATION algorithm as band multiplier from an EMA mid.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
// 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" |
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