Author of the Idea: Vladimir
MQL5 Code Author: barabashkakvn
This EA utilizes the iCCI (Commodity Channel Index) indicator value from the last four bars, alongside Open and Close prices from the last three bars. The system checks for a position opening signal when there are less than 20 seconds remaining before the current bar closes. This is a rare approach and is only executed if there are no open positions by this EA.
Position Opening Conditions
//--- BUY if(cci[1]<5 && cci[2]<cci[3] && cci[1]<cci[2] && cci[0]>cci[1] && Open[2]>Close[2] && Open[1]>Close[1] && Open[0]<Close[0] && Open[1]<Close[0]) //--- SELL if(cci[1]>-5 && cci[2]>cci[3] && cci[1]>cci[2] && cci[0]<cci[1] && Open[2]<Close[2] && Open[1]<Close[1] && Open[0]>Close[0] && Open[1]>Close[0])
Where:
- cci[] - array of CCI indicator values;
- Open[] and Close[] - arrays of open and close prices respectively.
Main Trading Settings
- Lots - constant position volume (if martingale and incremental volume increase are disabled) or the initial lot size for martingale and incremental volume increase;
- Stop Loss ("0.0" → disabled);
- Take Profit ("0.0" → disabled);
- Trailing Stop ("0.0" → disabled);
- Trailing Step.
CCI Parameters
- CCI: Averaging Period - the averaging period;
- CCI: Type of Price - type of price used to calculate the indicator.
Position Volume
You can define this in one of the following ways:
- fixed lot (Lots);
- martingale (Use martingale);
- incremental volume increase (Use step by step).
Let's dive deeper into the last two methods for setting position volume:
Martingale
This method kicks in when a losing position (or positions) shows up in your trading history. Key settings include:
- Use martingale - martingale activation flag;
- Martingale Coefficient - the ratio for increasing position volume;
- Ordinal Number of the Losing Trade - the index of the losing trade where volume increase starts;
- Maximum Number of Multiplications - the cap on how many times position volume can increase in a row.
Volume Incremental Increase
This method applies to both losing and winning position series. Key settings include:
- Use step by step - flag to activate incremental lot increases;
- Step Lots - the volume increase step;
- Maximum Lots - the peak volume to be used with incremental lot increases;
- Use Step After... - apply incremental volume increase after:
- ... losing - a losing trade;
- ... profitable - a profitable trade.
When using martingale, be cautious with the Stop Loss, Take Profit, Trailing Stop, and Trailing Step parameters, in addition to martingale settings.
The default parameters are M15, with an initial deposit of $10,000, tested across all symbols:
| Symbol | Pass | Result | Profit | Expected Payoff | Profit Factor | Recovery Factor | Sharpe Ratio | Custom | Equity DD % | Trades |
|---|---|---|---|---|---|---|---|---|---|---|
| EURGBP | 12 | 510.69 | 678.56 | 3.29 | 1.27 | 0.55 | 0.05 | 0 | 12.14 | 206 |
| USDCHF | 1 | 180.17 | 250.96 | 0.81 | 1.08 | 0.32 | 0.02 | 0 | 7.25 | 310 |
| EURCHF | 14 | 178.94 | 227.73 | 0.80 | 1.08 | 0.22 | 0.02 | 0 | 9.93 | 284 |
| USDCAD | 3 | 87.20 | 113.09 | 0.28 | 1.03 | 0.15 | 0.01 | 0 | 7.26 | 409 |
| AUDJPY | 9 | 27.45 | 1.28 | 0.00 | 1.00 | 0.00 | 0.00 | 0 | 7.44 | 417 |
| CADCHF | 18 | -42.18 | -101.84 | -0.37 | 0.97 | -0.09 | 0.00 | 0 | 10.53 | 272 |
| AUDUSD | 5 | -82.46 | -160.03 | -0.53 | 0.95 | -0.14 | -0.01 | 0 | 10.91 | 301 |
| EURCAD | 6 | -82.68 | -233.21 | -0.42 | 0.95 | -0.19 | -0.01 | 0 | 11.98 | 562 |
| USDJPY | 4 | -90.72 | -211.15 | -0.52 | 0.95 | -0.21 | -0.01 | 0 | 9.63 | 404 |
| EURUSD | 0 | -181.05 | -451.65 | -1.07 | 0.90 | -0.24 | -0.02 | 0 | 17.60 | 422 |
| AUDNZD | 7 | -227.43 | -305.03 | -0.94 | 0.89 | -0.39 | -0.02 | 0 | 7.54 | 324 |
| GBPUSD | 2 | -245.81 | -838.84 | -1.76 | 0.86 | -0.62 | -0.03 | 0 | 13.20 | 477 |
| EURNZD | 15 | -390.22 | -1381.32 | -2.01 | 0.80 | -0.68 | -0.05 | 0 | 20.18 | 686 |
| EURJPY | 16 | -390.24 | -1210.77 | -2.19 | 0.80 | -0.58 | -0.04 | 0 | 20.45 | 553 |
| EURAUD | 13 | -477.19 | -1483.33 | -2.41 | 0.77 | -0.64 | -0.06 | 0 | 22.12 | 616 |
| GBPJPY | 19 | -558.54 | -2645.95 | -3.87 | 0.69 | -0.81 | -0.08 | 0 | 32.18 | 683 |
| GBPCHF | 17 | -626.44 | -3325.40 | -6.56 | 0.63 | -0.83 | -0.09 | 0 | 39.28 | 507 |
| AUDCHF | 10 | -738.94 | -1472.97 | -5.11 | 0.67 | -0.67 | -0.09 | 0 | 21.09 | 288 |
| CHFJPY | 11 | -920.15 | -5540.53 | -12.95 | 0.42 | -0.92 | -0.21 | 0 | 58.57 | 428 |
| AUDCAD | 8 | -1541.16 | -3692.85 | -12.69 | 0.35 | -0.94 | -0.24 | 0 | 39.19 | 291 |
Comments 0