Weighted Moving Average (WMA) With Bollinger Bands

A Weighted Moving Average places more weight on recent values and less weight on older values. Bollinger bands rely on standard deviations in order to adjust to changing market conditions. When a stock becomes volatile the bands widens (move further away from the average). Conversely, when market becomes less volatile the bands contracts (move closer to the average).

SMA(CLOSE,9)  : Simple Moving Average of 9 period on Close
EMA(ma1,9)      : Exponential Moving Average of 9 period on SMA
WMA(ma2,5)    : Weighted Moving Average of 5 period on EMA

BUY{
SET ma1 = SMA(CLOSE,9);
SET ma2 = EMA(ma1,9);
SET ma3 = WMA(ma2,5);
SET vol = SMA(VOLUME,10);
SET bbt = BBT(CLOSE,10,2,SIMPLE); 
SET smab = SMA(bbt,50);
CROSSOVER(ma1,ma3) and CLOSE > bbt and VOLUME > vol and CLOSE > smab AND EMA(ma1,9) > SMA(bbt,50);}
SELL{
SET ma1 = SMA(CLOSE,9);
SET ma2 = EMA(ma1,9);
SET ma3 = WMA(ma2,5);
CROSSOVER(ma3,ma1);}

This slideshow requires JavaScript.

Advertisements

MACD With Bollinger Bands

We used Moving Average Convergence/Divergence (MACD) indicator to identify the direction of the market and to avoid whipsaw in a sideways market we added Bollinger Bands.

BUY : When MACD Crossed Above MACD Signal and Current High is greater than Bollinger Band Top.

SELL : When MACD Crossed Below MACD Signal and Current Low is Lower than Bollinger Band Bottom.

BUY{
SET a = MACDSignal(13,26,9,SIMPLE);
SET b = MACD(13,26,9,SIMPLE);
SET Bottom = BBB(CLOSE,12,2,SIMPLE);
SET Top = BBT(CLOSE,12,2,SIMPLE);
CROSSOVER(b,a) and HIGH>Top;}

b

SELL{
SET a = MACDSignal(13,26,9,SIMPLE);
SET b = MACD(13,26,9,SIMPLE);
SET Bottom = BBB(CLOSE,12,2,SIMPLE);
SET Top = BBT(CLOSE,12,2,SIMPLE);
CROSSOVER(a,b) and LOW<Bottom;} 

s