This Expert Advisor is based on previous candlestick’s price direction. Seven modes of operation with option to reverse signal. Assuming that current trend can be identified by checking status of one
recent candlestick I have added additional strategies: 2/2, 2/3, 3/3, 3/5, 4/5, 5/5 candlesticks. For “1/1 Candles (Mode 1)”: if previous
candlestick’s base currency has increased in value in reference to quote
currency (close price is higher than open price) – uptrend is presumed
and buy order is placed; otherwise sell order is placed – if previous candlestick’s base currency value has decreased in reference to quote currency (downtrend).
External parameters
Signal settings:
- SignalMode:
- 1/1 Candles (Mode 1) – if 1 previous candlestick’s close price is higher than open price then
buy order is placed, otherwise if 1 previous candlestick’s open price
is higher than close price then sell order is placed.
- 2/2 Candles (Mode 2) – if 2 previous candlestick’s close price is higher than open price then
buy order is placed, otherwise if 2 previous candlestick’s open price
is higher than close price then sell order is placed.
- 2/3 Candles (Mode 3) – if any 2 candlesticks’ close price is higher than open price within
the range of 3 previous candlesticks then buy order is placed, otherwise
if any 2 candlesticks’ open price is higher than close price within
the range of 3 previous candlesticks then sell order is placed.
Examples: white, black, white – buy order is placed; white, white, black – buy
order is placed; black, white, black – sell order placed; white, black, black – sell
order placed (in these examples white candlestick is the one that has
close price higher than open price, while black candlestick is the one
that has open price higher than close price.
- 3/3 Candles (Mode 4) – if 3 previous candlestick’s close price is higher than open price then
buy order is placed, otherwise if 3 previous candlestick’s open price
is higher than close price then sell order is placed.
- 3/5 Candles (Mode 5) – if any 3 candlesticks’ close price is higher than open price within
the range of 5 previous candlesticks then buy order is placed, otherwise
if any 3 candlesticks’ open price is higher than close price within
the range of 5 previous candlesticks then sell order is placed.
- 4/5 Candles (Mode 6) – if any 4 candlesticks’ close price is higher than open price within
the range of 5 previous candlesticks then buy order is placed, otherwise
if any 4 candlesticks’ open price is higher than close price within
the range of 5 previous candlesticks then sell order is placed.
- 5/5 Candles (Mode 7) – if 5 previous candlestick’s close price is higher than open price then
buy order is placed, otherwise if 5 previous candlestick’s open price
is higher than close price then sell order is placed.
- Reverse trade signal (true or false) – changes signal to its opposite (for buy – sell order is sent, for sell – buy order is sent)
Order settings:
- Take Profit**
- Stop Loss**
- Lot size
- Slippage**
- Magic number
**These values are set in pips (0.0001). 1 pip = 10 points for 5 digits broker.
The logic behind Expert Advisor’s algorithm
It may seem
that single candlestick is not sufficient statistical data to
identify the current trend, however if a trend is strong enough, then corresponding candlesticks will prevail and show up repeatedly.
Additional modes added to this strategy may detect current trend with higher accuracy. Signal lagging is from 1 up to 5 bars, depending on
mode of operation.
Hedging (FIFO) and Order processing
This Expert Advisor is FIFO “First In First Out” compliant, therefore
hedging is not possible. An order is sent by bar
and closes by tick.