Loading…

Volatility Parity Position Sizer

A flat 0.10 lots means something completely different on EURUSD, XAUUSD and a JPY cross - different pip values, different typical daily ranges, different contract sizes. Running the same lot size across several symbols does not produce comparable risk; it produces whatever risk each symbol's own volatility happens to hand out. This tool sizes off the symbol's own ATR instead, so a chosen number of "typical moves" always costs the same money regardless of which instrument it is attached to - the actual meaning of volatility parity across a portfolio. The money-per-point figure behind every calculation comes strictly from the broker's own tick value and tick size, never a hardcoded contract size. A fixed 100000 multiplier, the textbook forex lot assumption, is silently wrong on metals, indices and any account currency that is not the symbol's quote currency - exactly the kind of error that makes multi-symbol risk comparisons meaningless without anyone noticing. Attach the tool to each symbol in a portfolio with the same InpTargetRiskMoney value and it reports the lot size that makes one configured ATR-multiple move cost that same amount everywhere. Optional Buy/Sell buttons place a market order at the computed size with a protective stop at the same ATR distance the sizing was measured against, so the position's real risk matches what was targeted. Notes and limitations - The ATR read is the last CLOSED bar's value, so the panel does not wobble as the current bar forms - it updates once per new bar. - This is a sizing calculator with an optional order button attached, not a trading strategy - it has no entry signal of its own. - Parity across symbols only holds while InpTargetRiskMoney (or the risk percent, less precisely) is kept identical on every chart it is attached to. - On MQL5 netting accounts, a foreign-magic position already open on the chart symbol blocks the Buy/Sell buttons rather than merging into it - see above.

Expert advisor · MT4 · v1.0 · Free

About Volatility Parity Position Sizer

Volatility Parity Position Sizer is an expert advisor (trading robot) for MetaTrader 4 based on ATR. It can size trades from your balance and risk percent. It has 11 settings, such as Atr period, Atr multiple and Target risk money. MQL source code included.

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

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

Settings

SettingDefaultWhat it does
Atr period14ATR period defining "one normal move" for this symbol
Atr multiple1.0How many ATRs the target risk money is measured against
Target risk money100.0Money, in account currency, that one InpAtrMultiple-ATR move should cost
Use risk percentfalseUse InpRiskPercent of balance instead of the fixed money target above
Risk percent1.0Percent of balance risked per InpAtrMultiple-ATR move, used only when the switch above is on
Magic number20260906Magic number for orders opened from this panel
Slippage pips3Slippage tolerance for market orders, in pips
Max retries5Attempts per trade action before giving up
Retry wait ms500Pause between attempts, milliseconds
Panel x10Button panel X offset, pixels from corner
Panel y20Button panel Y offset, pixels from corner

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: Gold (XAUUSD) · ATR · Risk & Lot Size · EURUSD · MT4 Expert Advisor · MQL4 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria