Skip to content
All library documents

Position Sizing from Account Risk, Stop Distance, and ATR

Article MQL5 code base

Summary

This document describes a MetaTrader 5 chart indicator that calculates a suggested lot size from account balance, a chosen risk percentage, and stop-loss distance. Its central method divides the intended cash risk by the loss associated with one lot at the specified stop distance, then rounds the result to the broker’s allowed lot increments and limits. It can use a fixed stop distance or scale the stop with Average True Range (ATR).

The on-chart display reports balance, risk amount, tick value, required margin, and suggested size, and flags cases where the minimum tradable lot would exceed the selected risk. This is a practical description of a sizing aid rather than a tested trading strategy: it provides no performance evidence, and its estimate depends on the stop being honored and the instrument’s contract and tick specifications being represented correctly. The document does not discuss slippage, gaps, commissions, or how to choose the risk percentage or ATR settings.

Key ideas

  • Position size is derived from the account’s chosen cash risk and the loss per lot at the stop distance.
  • The indicator can set the stop distance with fixed points or ATR-based volatility scaling.
  • Suggested lots are normalized to the broker’s minimum, maximum, and step size.
  • A warning is shown when the minimum allowed lot would breach the selected risk limit.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.