inputs: EMA_Length( 22 ), Lambda( 0.5 ) , PctAbove( 0.5 ), PctBelow( 0.5 ), Displace( 0 ) ; variables: RegEMA( 0 ), Alpha( 2 / ( EMA_Length + 1 ) ) , LowerBand( 0 ), UpperBand( 0 ), PctBelowFactor( 1 - ( PctBelow * .01 ) ) , PctAboveFactor( 1 + ( PctAbove * .01 ) ) ; if CurrentBar > 3 then RegEMA = (RegEMA[1]*(1+2*Lambda) + Alpha * (C-RegEMA[1]) - Lambda * RegEMA[2])/(1+lambda) else RegEMA = Close ; LowerBand = RegEMA * PctBelowFactor ; UpperBand = RegEMA * PctAboveFactor ; Plot1 (UpperBand, "UpperBand" ) ; Plot2 (LowerBand, "LowerBand" ) ; Plot3 ( RegEMA, "MidLine" ) ;