Divergence Trader
Divergence Trader — a MetaTrader 4 expert advisor (trading robot) kept in the Old Kings collection. Judging by its name, it is built around divergence between price and an oscillator. Its source code uses moving averages. It places pending orders, moves the stop behind price and has a trading-hours filter. It has 17 settings, for example Lots (default 0.1), Slippage (default 2) and Fast Period (default 7). 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 Trader
Divergence Trader is an expert advisor (trading robot) for MetaTrader 4 based on Moving Average. It places pending buy/sell stop or limit orders, moves the stop loss behind price (trailing stop / break-even) and trades only in the hours you set (time filter). It has 17 settings, such as Lots, Slippage and Fast period. MQL source code included.
It also can size trades from your balance and risk percent.
Files in the download: Divergence_Trader(1).mq4.
Trading robots can lose money. Check every setting and test on a demo account before using real funds.
Settings
| Setting | Default | What it does |
|---|---|---|
| Lots | 0.1 | how many lots to trade at a time |
| Slippage | 2 | how many pips of slippage can you tolorate |
| Fast period | 7 | Period or timeframe used by the calculation |
| Fast price | PRICE_OPEN | |
| Slow period | 88 | Period or timeframe used by the calculation |
| Slow price | PRICE_OPEN | |
| Dv buy sell | 0.0011 | |
| Dv stay out | 0.0079 | |
| Profit made | 0 | how much money do you expect to make |
| Loss limit | 0 | how much loss can you tolorate |
| Trail stop | 9999 | trailing stop (999=no trailing stop) |
| Pl break even | 9999 | set break even when this many pips are made (999=off) |
| Start hour | 0 | your local time to start making trades |
| Stop hour | 24 | your local time to stop making trades |
| Basket profit | 75 | if equity reaches this level, close trades |
| Basket loss | 9999 | if equity reaches this negative level, close trades |
| File data | false |
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 · Trailing Stop & Break-even · Time Filter · Risk & Lot Size · Moving Average · MT4 Expert Advisor · MQL4 Source Code