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;}
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;}