Hey fellow traders! If you're looking for a reliable Expert Advisor (EA) to help you navigate the markets, the N Candles v6 could be just what you need. This EA specializes in identifying a sequence of identical candlesticks, making it easier to capitalize on trending movements. It buys during bullish candlesticks and sells during bearish ones, ensuring your strategy aligns with market momentum.
The N Candles v6 also checks whether your account is netting or hedging. In its programming, it utilizes several key trade classes, namely CPositionInfo, CTrade, CSymbolInfo, and CAccountInfo.
- Version 1: N Candles.
- Version 2: N Candles v2.
- Version 3: N Candles v3.
- Version 4: N Candles v4.
- Version 5: N Candles v5.
What's New in Version 6
This latest version introduces new closing options when a 'black sheep' is encountered:
- Close all positions.
- Close positions that oppose the 'black sheep'.
- Close positions that move in the same direction as the 'black sheep'.
Understanding the "Black Sheep" Concept
So, what’s this 'black sheep' all about? Imagine the EA is on the lookout for five identical candlesticks. If it finds five bullish candlesticks in a row and opens a Buy position, any subsequent candlestick that isn’t bullish is deemed a 'black sheep'. This feature helps you manage trades better during unexpected market shifts.
Input Parameters
- N identical candles in a row - Set the number of identical candlesticks you want to track.
- Lot - Define the position volume.
- Take Profit - Specify the take profit value (not used if set to 0).
- Stop Loss - Set your stop loss value (not used if set to 0).
- Trailing Stop - Input the trailing stop value (not used if set to 0).
- Trailing Step - Set the trailing step value (not used if set to 0).
- Max positions in one direction (for hedging) - Limit the number of positions allowed in one direction on hedging accounts.
- Max position volume (for netting) - Set the maximum volume for open positions on netting accounts.
- Use trade hours - Enable or disable a time filter.
- Start hour - Specify when trading should begin.
- End hour - Specify when trading should stop.
- Magic number - A unique identifier for the EA.
- Closure type for 'black sheep' - Choose the closing strategy to apply when a 'black sheep' is detected.
In this version, you can opt to disable Take Profit, Stop Loss, and Trailing Stop. In such cases, your positions will close based on the 'black sheep' parameter.
Here’s an example of testing on the D1 timeframe, covering the period from April 18, 2017, to February 10, 2018, in Every Tick mode:

| Symbol | Pass | Result | Profit | Expected Payoff | Profit Factor | Recovery Factor | Sharpe Ratio | Custom | Equity DD % | Trades |
|---|---|---|---|---|---|---|---|---|---|---|
| AUDJPY | 0 | 234,868.07 | 26,677.92 | 592.84 | 3.06 | 2.23 | 0.42 | 0 | 17.42 | 45 |
| EURCHF | 2 | 182,707.90 | 21,403.45 | 548.81 | 2.56 | 0.97 | 0.34 | 0 | 26.12 | 39 |
| AUDUSD | 3 | 176,864.42 | 23,113.10 | 462.26 | 2.42 | 1.40 | 0.33 | 0 | 23.34 | 50 |
| USDJPY | 1 | 161,759.58 | 16,625.68 | 573.30 | 2.43 | 0.66 | 0.38 | 0 | 44.97 | 29 |
| GBPUSD | 4 | 106,435.34 | 15,526.40 | 378.69 | 1.62 | 0.61 | 0.20 | 0 | 29.82 | 41 |
| USDCHF | 5 | 51,537.85 | 445.34 | 11.42 | 1.02 | 0.02 | 0.02 | 0 | 31.45 | 39 |
| USDCAD | 6 | 40,360.28 | -3,701.81 | -88.14 | 0.87 | -0.15 | -0.04 | 0 | 35.79 | 42 |
| EURCAD | 7 | 38,152.04 | -4,512.05 | -132.71 | 0.84 | -0.17 | -0.06 | 0 | 42.95 | 34 |
| #AA | 9 | 34,847.02 | -1,795.40 | -51.30 | 0.72 | -0.52 | -0.12 | 0 | 6.95 | 35 |
| EURJPY | 8 | 23,499.63 | -14,049.99 | -326.74 | 0.65 | -0.26 | -0.18 | 0 | 62.68 | 43 |
| EURUSD | 10 | 4,307.27 | -28,962.60 | -851.84 | 0.20 | -0.95 | -0.59 | 0 | 60.81 | 34 |
Related Posts
- Harnessing MQL5 Wizard for Trading Signals: 3 Black Crows & 3 White Soldiers with MFI
- Mastering Trading Signals with MQL5 Wizard: Bullish and Bearish Engulfing Strategies
- Mastering Bullish and Bearish Harami Patterns with Stochastic in MT5
- Mastering NirvamanImax: Your Go-To EA for MetaTrader 4
- RRS Impulse: Your Go-To Scalping EA for MetaTrader 4