Topic: Three Bars Swing Pattern requested by ahmedalhoseny
The rules are shown in the code:
for (int bar = firstBar; bar < Bars; bar++)
{
// Long trade
if (Close[bar - 3] < Open[bar - 3] && // Candle 1 is black
Low[bar - 2] < Low[bar - 3] && // Candle 2 has lower low than candle 1
Close[bar - 1] > Open[bar - 1] && // Candle 3 is white
Low[bar - 1] > Low[bar - 2] && // Candle 3 has higher low than candle 2
Close[bar - 1] > Open[bar - 3]) // Candle 3 closes above candle 1 open
longSignals[bar] = 1;
// Short trade
if (Close[bar - 3] > Open[bar - 3] && // Candle 1 is white
High[bar - 2] > High[bar - 3] && // Candle 2 has higher high than candle 1
Close[bar - 1] < Open[bar - 1] && // Candle 3 is black
High[bar - 1] < High[bar - 2] && // Candle 3 has lower high than candle 2
Close[bar - 1] < Open[bar - 3]) // Candle 3 closes below candle 1 open
shortSignals[bar] = 1;
}
Possible usage:
EDIT
Indicator was updated on April 12, 2012 due to a bug: Indicator doesn't trade.
Please update your indicator with attached below: