The Expert Advisor searches for N identical candlesticks in a row. It buys on bullish candlesticks and sells on bearish ones. The EA checks if the account is netting or hedging. The CPositionInfo, CTrade, CSymbolInfo and CAccountInfo trade classes are used in the code.
Added types of closure when a "black sheep" is met:
Suppose, the Expert Advisor searches for 5 identical candlesticks. Then the EA finds five bullish candlestick in a row and opens a Buy position. If the next candlestick after the position opening is not a bullish one, such a candlestick is considered a "black sheep".
In this version you can disable Take Profit, Stop Loss and Trailing Stop - in this case positions will be closed by the "black sheep" parameter.
Example of testing on D1 from 2017.04.18 to 2018.02.10 in the Every Tick mode:

| Symbol | Pass | Result | Profit | Expected Payoff | Profit Factor | Recovery Factor | Sharpe Ratio | Custom | Equity DD % | Trades |
|---|---|---|---|---|---|---|---|---|---|---|
| AUDJPY | 0 | 234868,07 | 26677,92 | 592,84 | 3,06 | 2,23 | 0,42 | 0 | 17,42 | 45 |
| EURCHF | 2 | 182707,90 | 21403,45 | 548,81 | 2,56 | 0,97 | 0,34 | 0 | 26,12 | 39 |
| AUDUSD | 3 | 176864,42 | 23113,10 | 462,26 | 2,42 | 1,40 | 0,33 | 0 | 23,34 | 50 |
| USDJPY | 1 | 161759,58 | 16625,68 | 573,30 | 2,43 | 0,66 | 0,38 | 0 | 44,97 | 29 |
| GBPUSD | 4 | 106435,34 | 15526,40 | 378,69 | 1,62 | 0,61 | 0,20 | 0 | 29,82 | 41 |
| USDCHF | 5 | 51537,85 | 445,34 | 11,42 | 1,02 | 0,02 | 0,02 | 0 | 31,45 | 39 |
| USDCAD | 6 | 40360,28 | -3701,81 | -88,14 | 0,87 | -0,15 | -0,04 | 0 | 35,79 | 42 |
| EURCAD | 7 | 38152,04 | -4512,05 | -132,71 | 0,84 | -0,17 | -0,06 | 0 | 42,95 | 34 |
| #AA | 9 | 34847,02 | -1795,40 | -51,30 | 0,72 | -0,52 | -0,12 | 0 | 6,95 | 35 |
| EURJPY | 8 | 23499,63 | -14049,99 | -326,74 | 0,65 | -0,26 | -0,18 | 0 | 62,68 | 43 |
| EURUSD | 10 | 4307,27 | -28962,60 | -851,84 | 0,20 | -0,95 | -0,59 | 0 | 60,81 | 34 |
MetaQuotes Ltd에서 러시아어로 번역함.
원본 코드: https://www.mql5.com/ru/code/20000
Pipsover 2
The Expert Advisor works based on the iChaikin (Chaikin Oscillator) and iMA (Moving Average, MA) indicators.
MACDSimpleReshetov
An Expert Advisor trading MACD signals. For those who prefer trading CFDs and futures symbols.
Elders Safe Zone
An indicator based on Elder's "Safe Zone".
MACD EA
The Expert Advisor uses three iMA (Moving Average, MA) indicators and one iMACD (Moving Average Convergence/Divergence, MACD)