Synthetic Pair Trader MT4
- Experts
-
Mario Jemic
Analista Certificato dei Mercati dei Capitali e dei Titoli
Investitore professionale.
Ingegnere sviluppatore dietro FXCM Trading Station.
Ho l’opportunità di lavorare con alcune delle tecnologie più avanzate disponibili oggi.
Posizione attuale: Zagabria, Croazia
Impieghi precedenti: - Versione: 1.0
- Attivazioni: 5
Turn any two symbols (XAUUSD/XAGUSD, an index against another, GBPUSD/EURUSD) into one synthetic: candle chart with bands, and both legs traded as one position.
Description
Synthetic Pair Trader turns any two symbols of your broker into one instrument. It draws the synthetic as a candle chart in its own pane on your chart, with its mean and 2-sigma bands, and a panel trades it as one position: buy or sell the synthetic, and both legs are opened, sized, protected and closed together.
Examples: gold against silver (XAUUSD / XAGUSD), an index against another index (US30 / SPX500), crosses your broker does not offer (GBPUSD / EURUSD), oil against gas, a stock CFD against its index.
Synthetic chart
- Four formulas: ratio A / B, log ratio ln(A / B) x 100, spread A - k x B, product A x B; optional scale.
- Candles of the synthetic on the timeframe of the chart, built from both legs aligned by time; when one leg has no bar (different session hours), its last close is carried over.
- Mean and 2-sigma bands, the current value on the price scale, and the entry, stop and target of every open synthetic position.
- The "Chart" button shows or hides the pane; its size is an input.
Statistics on the panel
- Current synthetic price, correlation and beta of the two legs (H1 returns), z-score of the synthetic against its average.
- Lot size of both legs for the chosen position value, before you trade.
Costs before you trade
- One line under the statistics: spread cost, swap per night of a long and a short synthetic, margin of both legs.
- The "Costs" button opens the details: spread cost of each leg in money and %, pip value (forex) or value of a 1.00 move (indices, metals, CFDs) of each leg, swap per night long and short, triple-swap day and time to the next rollover, margin of both legs and free margin, trading session of each leg (open until, or closed until).
- For open positions: the result includes swap and commission, shown separately under the list.
Trading the synthetic
- Buy synthetic = buy A and sell B (for the product formula, both legs in the same direction); sell synthetic = the opposite.
- Leg A is sized by its value in the account currency; leg B by equal value, beta-weighted value or k x the value of leg A. Lots follow the minimum and step of each symbol.
- Stop and target in % of the synthetic price, shown on the synthetic chart.
- When the synthetic reaches its stop or target, both legs are closed. Close one position or all with a button.
- If the second leg cannot be opened, the first one is closed again, so no single leg is left open. A leg closed outside the EA closes the other leg too.
- Positions are saved in a file and picked up again after a restart of the terminal.
Inputs
- Pair: leg A (empty = chart symbol), leg B, formula, k, scale.
- Trading: value of leg A per position, size of leg B, bars for beta / correlation / z-score, stop and target %, magic number, slippage.
- Display: synthetic chart pane open at start and its size, colours, panel position, costs section open at start.
Notes
- Both legs must be symbols of the same broker account and must be tradable at the same time. Outside the market hours of a leg, orders are rejected; the EA retries closing once a minute.
- MetaTrader 4 has no custom symbols: the synthetic is drawn in its own pane on the chart of leg A, not as a separate symbol. The MT5 version creates a real custom symbol.
- The stop and target are watched by the EA on the synthetic price, not placed at the broker: the EA must run (VPS for 24/7). Each leg has its own spread, swap and commission.
- Lot sizes depend on the contract sizes of your broker: with a large minimum lot (for example 1 lot = 1 ounce of gold), the two legs are matched as closely as the lot steps allow.
- The Strategy Tester of MetaTrader 4 trades the chart symbol only: there the EA opens sample synthetic positions with both legs on the chart symbol, so the two-leg logic can be checked.
- A synthetic pair is not a hedge against loss: both legs can move against you. No promise of profit.
- No DLLs, no external files besides its own state file.
