Loading…

Mirror Order On Correlated Symbol

Spreading one trade idea across two correlated symbols - long EURUSD mirrored as long GBPUSD, or hedged as short EURUSD against long USDCHF - runs into a sizing problem immediately: 0.10 lots of one symbol is not 0.10 lots of another. A pip of EURUSD and a pip of USDJPY are different amounts of money, and on metals or indices the difference is an order of magnitude. Copying the lot number mirrors the label, not the position. This script matches what actually matters: money per pip. It reads both symbols' tick values at current prices - tick value already contains the conversion into the account currency, and it moves with the market, which is why both symbols are refreshed at the moment of sizing - and solves mirror lots = source lots * pip value(source) / pip value(target) so an equal pip move on the two symbols produces an equal profit or loss in account currency. The result is floored to the target's lot grid, never rounded up, and the confirmation states both sides' money-per-pip with the percentage mismatch the flooring introduced. If even the target's minimum lot moves more money per pip than the whole source position, the script refuses with both numbers rather than opening an oversized "mirror". Direction is explicit: SAME opens the target in the source's direction (for positively correlated symbols), INVERTED opens it opposite (for negatively correlated ones, EURUSD against USDCHF being the classic pair). Which one expresses your intent - doubling the idea or offsetting it - depends on the sign of the correlation, and that is your call, not the script's. Two things this script deliberately does not do. It does not measure correlation: correlations drift and regime-change, and a script that prints "0.87" would lend fake authority to a number that may be stale tomorrow. You assert the relationship; the script only makes the sizes comparable. And it does not place SL/TP on the mirror: translating stops across symbols is a trading decision, not an arithmetic one, and the confirmation and the final summary both remind you the mirror is naked. If several positions are open on the chart symbol, the script refuses and lists them in the Experts log - ticket, side, volume - so the ticket input can pick one. Guessing which position to mirror is how the wrong trade gets doubled. Notes and limitations - The script does not measure, estimate or verify correlation. If the two symbols are not actually related, the "mirror" is just two unrelated positions. - Money-per-pip equivalence assumes the two symbols move a comparable number of pips. That holds within FX majors and crosses; between asset classes (a gold "pip" versus a EURUSD pip) the equivalence is exact in money per pip but the typical pip counts differ, so judge accordingly. - The mirror is opened without SL/TP, and the source position is not modified in any way. - Flooring to the target's lot grid makes the match slightly smaller than the source; the confirmation shows the exact percentage. - Tick values are read at run time and drift with prices; the match is as of the moment of sizing.

Script · MT4 · v1.0 · Free

About Mirror Order On Correlated Symbol

Mirror Order On Correlated Symbol is an expert advisor (trading robot) for MetaTrader 4. It opens a grid of orders at fixed price steps and can size trades from your balance and risk percent. It has 8 settings, such as Target symbol, Direction and Source ticket. MQL source code included.

Files in the download: MirrorOnCorrelated.ex4, MirrorOnCorrelated.mq4, MirrorOnCorrelated.txt.

Trading robots can lose money. Check every setting and test on a demo account before using real funds.

Settings

SettingDefaultWhat it does
Target symbolTarget symbol to mirror onto
DirectionMIRROR_SAMEMirror direction
Source ticket0Source ticket (0 = the only position)
Magic0Magic number
Slippage pips3Slippage tolerance, pips
Max retries5Attempts before giving up
Retry wait ms500Pause between attempts, ms
Confirm firsttrueAsk for confirmation first

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Experts.
  3. Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
  4. Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the expert advisor from the Navigator onto a chart, check the settings, allow Algo/Auto Trading and press OK.
  6. Test it first on a demo account or in the Strategy Tester.

Download the PDF guide

Tags: Hedging · Volume · EURUSD · GBPUSD · USDJPY · Grid · Risk & Lot Size · MT4 Script · MQL4 Source Code

MQL4 & MQL5 scripts · PolyMaria