Moving Average Convergence / Divergence (MACD) AND Commodity Channel Index (CCI)

CCI indicator oscillates between an overbought and oversold condition and works best in a sideways market. The MACD fluctuates above and below the zero line as the moving averages converge, cross and diverge. Traders can look for signal line crossovers, centerline crossovers and divergences to generate signals.

BUY{
SET macd1 = MACD(100,21,9,SIMPLE);
SET macdsig = MACDSignal(100,21,9,SIMPLE); 
SET cci1 = CCI(50,SIMPLE); 
CROSSOVER(macdsig,macd1) and cci1 > 0.1;}

LONGEXIT{
SET macd1 = MACD(100,21,9,SIMPLE);
SET macdsig = MACDSignal(100,21,9,SIMPLE); 
SET cci1 = CCI(50,SIMPLE); 
CROSSOVER(macd1,macdsig) and cci1 < 0.1;}

SELL{
SET macd1 = MACD(100,21,9,SIMPLE);
SET macdsig = MACDSignal(100,21,9,SIMPLE);
SET cci1 = CCI(50,SIMPLE); 
CROSSOVER(macd1,macdsig) and cci1 < 0.1;}

SHORTEXIT{
SET macd1 = MACD(100,21,9,SIMPLE);
SET macdsig = MACDSignal(100,21,9,SIMPLE); 
SET cci1 = CCI(50,SIMPLE); 
CROSSOVER(macdsig,macd1) and cci1 > 0.1;}

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