Correlated Confirmation Breakout
A breakout on one instrument alone is often a local liquidity grab rather than a genuine market move; a second, related instrument breaking its own analogous level at close to the same time is much harder to explain away as noise. This EA formalises that idea with two gates that both have to pass. First, a rolling Pearson correlation of InpCorrelationBars log returns between the primary symbol and InpCorrelatedSymbol must clear InpMinCorrelation (positive) or InpMaxCorrelation (negative, for a genuinely inverse pair) - trading a "confirming" instrument that is not actually correlated to the primary right now would confirm nothing at all, so the correlation itself is checked fresh on every bar rather than assumed from the pair's reputation. Second, once the primary closes beyond its own InpRangeBars high/low, the correlated symbol's own InpRangeBars high/low must ALSO have broken - in the same direction on a positive correlation, or the opposite direction on a negative one - within InpConfirmWindowBars of the primary's break. A confirmation from days earlier is stale and is not accepted; the window keeps the two breaks tied to the same underlying event. Notes and limitations - The correlation is recalculated every closed bar from log returns - it can and will drift in and out of the required threshold over time, which is the point; a pair that is normally correlated but has temporarily decoupled will correctly stop confirming trades. - InpCorrelatedSymbol must be tradeable/quotable on the same broker and its own price history must be available; a symbol with no history loaded yet will read as never breaking until its data syncs. - The confirmation window looks BACKWARD from the current bar for a qualifying correlated-symbol break within InpConfirmWindowBars bars - it does not wait forward for a confirmation that has not happened yet, so a primary break with no correlated confirmation inside the window is simply skipped, not queued. - Lot sizing uses MODE_TICKVALUE/MODE_TICKSIZE, not a hardcoded contract size. - Only one position at a time on the primary symbol; the EA never trades InpCorrelatedSymbol itself.
Expert advisor · MT5 · v1.0 · Free
About Correlated Confirmation Breakout
Correlated Confirmation Breakout is an expert advisor (trading robot) for MetaTrader 5. It can size trades from your balance and risk percent and trades breakouts. It has 16 settings, such as Correlated symbol, Range bars and Correlation bars. MQL source code included.
Files in the download: CorrelatedConfirmationBreakout.ex5, CorrelatedConfirmationBreakout.mq5, CorrelatedConfirmationBreakout.txt.
Trading robots can lose money. Check every setting and test on a demo account before using real funds.
Settings
| Setting | Default | What it does |
|---|---|---|
| Correlated symbol | GBPUSD | Symbol whose own breakout must confirm the primary's |
| Range bars | 20 | Bars defining the breakout range on each symbol |
| Correlation bars | 60 | Bars of log returns used for the rolling correlation |
| Min correlation | 0.5 | Minimum POSITIVE correlation required to treat the pair as confirming |
| Max correlation | -0.5 | Maximum NEGATIVE correlation required for an inverse-confirming pair |
| Confirm window bars | 3 | Correlated symbol's break must occur within this many bars of the primary's |
| Break buffer pips | 2.0 | Close must clear the primary's range by this many extra pips |
| Use risk sizing | true | Size by percent risk to the stop instead of a fixed lot |
| Risk percent | 1.0 | Percent of equity risked per trade, when risk sizing is on |
| Fixed lots | 0.10 | Lot size when risk sizing is off, or as a sizing fallback |
| Stop buffer pips | 5.0 | Extra pips beyond the primary range's far edge used for the stop |
| Reward risk ratio | 2.0 | Take-profit distance as a multiple of the stop distance |
| Magic number | 43761 | Magic number for orders opened by this EA |
| Slippage pips | 3 | Slippage tolerance, in pips |
| Max retries | 5 | Attempts per trade action before giving up |
| Retry wait ms | 500 | Pause between attempts, milliseconds |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Experts.
- Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
- Open the .mq5 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: Breakout · Risk & Lot Size · MT5 Expert Advisor · MQL5 Source Code