Divergence Ea
Divergence Ea — a MetaTrader 4 expert advisor (trading robot) kept in the Old Kings collection. Its name points to divergence between price and an oscillator. Its source code uses MACD, RSI, the Stochastic oscillator and moving averages. It places pending orders and can size trades from your risk. It has 40 settings, for example string1 (default Parameters of orders / ), static Lots (default 0.1) and dynamic Lots (default 10.0). Before any live use, test it on a demo account and check its lot size, stop loss and trading hours. Inside: 1 EA file with source code (.mq4) you can open and edit in MetaEditor. Old Kings are classic community tools shared as-is. Not tested by PolyMaria. Try it on a demo account first. Are you the author of this tool? Message us on Telegram (@abumarket_support) and we will credit you or take it down.
Expert advisor · MT4 · v1.0 · Free
About Divergence Ea
Divergence Ea is an expert advisor (trading robot) for MetaTrader 4 based on MACD, RSI, Stochastic and Moving Average. It places pending buy/sell stop or limit orders and can size trades from your balance and risk percent. It has 40 settings, such as I string1, I static lots and I dynamic lots. MQL source code included.
Files in the download: mql4\Include\Common\Common_GetSymbolInfo.mqh, mql4\Include\Common\Common_MathUtils.mqh, mql4\Include\Common\Common_Trade.mqh, mql4\Include\Divergence\Divergence_CalculateSignal.mqh, mql4\Include\Divergence\Divergence_CalculateTradeType.mqh, mql4\Experts\Divergence_Expert.mq4, Best Trading Systems.url.
Trading robots can lose money. Check every setting and test on a demo account before using real funds.
Settings
| Setting | Default | What it does |
|---|---|---|
| I string1 | Parameters of orders / | ====================== |
| I static lots | 0.1 | Constant volume / |
| I dynamic lots | 10.0 | Dynamic volume, % of balance/ % |
| I tp to sl ratio | 2.0 | Ratio of the TP size to SL / TP SL |
| I sl offset | 1 | Offset for Stop Loss, pts. / Stop Loss, . |
| I string2 | Divergence parameters / | ============================ |
| I indicator type | WILLIAM_BLAU | Base indicator / |
| I divergence depth | 20 | Depth of 2nd ref. point search / 2 . |
| I bars period1 | 8000 | First calculate period / |
| I bars period2 | 2 | Second calculate period / |
| I bars period3 | 1 | Third calculate period / |
| I ind applied price | PRICE_CLOSE | Applied price of indicator / |
| I ind ma method | MODE_EMA | MA calculate method / |
| I find ext interval | 10 | Price ext. to indicator ext. / . . . |
| I market applied price | MARKET_APPLIED_PRICE_CLOSE | Applied price of market / |
| I custom name | Sentiment_Line | The name of indicator / |
| I custom buffer | 0 | Index of data buffer / |
| I custom param cnt | PARAM_CNT_3 | Amount of ind. parameters / - |
| I custom param1 | 13.0 | Value of the 1st parameter / 1- |
| I custom param2 | 1.0 | Value of the 2nd parameter / 2- |
| I custom param3 | 0.0 | Value of the 3rd parameter / 3- |
| I custom param4 | 0.0 | Value of the 4th parameter / 4- |
| I custom param5 | 0.0 | Value of the 5th parameter / 5- |
| I custom param6 | 0.0 | Value of the 6th parameter / 6- |
| I custom param7 | 0.0 | Value of the 7th parameter / 7- |
| I custom param8 | 0.0 | Value of the 8th parameter / 8- |
| I custom param9 | 0.0 | Value of the 9th parameter / 9- |
| I custom param10 | 0.0 | Value of the 10th parameter / 10- |
| I custom param11 | 0.0 | Value of the 11th parameter / 11- |
| I custom param12 | 0.0 | Value of the 12th parameter / 12- |
| I custom param13 | 0.0 | Value of the 13th parameter / 13- |
| I custom param14 | 0.0 | Value of the 14th parameter / 14- |
| I custom param15 | 0.0 | Value of the 15th parameter / 15- |
| I custom param16 | 0.0 | Value of the 16th parameter / 16- |
| I custom param17 | 0.0 | Value of the 17th parameter / 17- |
| I custom param18 | 0.0 | Value of the 18th parameter / 18- |
| I custom param19 | 0.0 | Value of the 19th parameter / 19- |
| I custom param20 | 0.0 | Value of the 20th parameter / 20- |
| I use coincidence charts | OFF | The coincidence of charts / |
| I exclude overlaps | OFF | Exclude overlaps of lines / |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Experts.
- Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
- Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the expert advisor from the Navigator onto a chart, check the settings, allow Algo/Auto Trading and press OK.
- Test it first on a demo account or in the Strategy Tester.
Tags: Divergence · Pending Orders · Risk & Lot Size · MACD · RSI · Stochastic · Moving Average · MT4 Expert Advisor · MQL4 Source Code