Volatility Sized Lot Ribbon
Most traders pick a fixed risk amount in account currency and then work out a lot size by hand from the current stop distance - a calculation that goes stale the moment volatility changes, because the same stop distance in pips no longer represents the same risk. This indicator does that arithmetic continuously and plots it as a line: for every bar, it reads that bar's ATR, multiplies it by InpAtrMultiple to get an assumed adverse-move distance, and solves for the lot size that would lose exactly InpRiskAmount if price moved that far against the position. The money-per-lot figure is built entirely from MarketInfo(symbol, MODE_TICKVALUE) and MarketInfo(symbol, MODE_TICKSIZE), read fresh for every bar rather than assumed from a hardcoded 100,000-unit forex lot. Gold, indices, and CFD-style symbols all have different tick values and tick sizes, and on some brokers MODE_TICKVALUE itself moves with the account currency conversion rate or even the current price - a cached constant goes wrong exactly when it matters. The result is then floored to the broker's MODE_LOTSTEP and clamped to MODE_MINLOT/MODE_MAXLOT, so the plotted number is always a lot size the broker will actually accept, not a theoretical figure that needs manual rounding. Notes and limitations - A reading of 0.0 means the risk budget cannot even afford the broker's minimum lot at the current volatility - not an error, a genuine "too volatile for this risk amount at this size" result. - This sizes against ATR, not an actual placed stop-loss distance; if your real stop is materially different from InpAtrMultiple times ATR, size off your own stop distance instead. - Does not place trades, orders or stops itself - it is a sizing reference only. - MODE_TICKVALUE on some symbols is itself price-dependent (metals, indices); the ribbon reflects that live, which means the lot size can shift slightly even when ATR itself has not moved much.
Indicator · MT5 · v1.0 · Free
About Volatility Sized Lot Ribbon
Volatility Sized Lot Ribbon is an indicator for MetaTrader 5 based on ATR. It has 3 settings, such as Risk amount, Atr period and Atr multiple. MQL source code included.
Files in the download: VolatilitySizedLotRibbon.ex5, VolatilitySizedLotRibbon.mq5, VolatilitySizedLotRibbon.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Risk amount | 100.0 | Fixed money risk (account currency) that one ATR of adverse move should equal |
| Atr period | 14 | ATR period used to measure one bar's typical adverse move |
| Atr multiple | 1.0 | Multiply ATR by this before sizing (e.g. 1.5 for a wider stop assumption) |
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 → Indicators.
- 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 indicator from the Navigator onto a chart and adjust the settings.
Tags: ATR · Risk & Lot Size · MT5 Indicator · MQL5 Source Code