Skip to content
All library documents

Calculating Position Size from Stop Loss and Risk Budget

Article MQL5 code base

Summary

This brief description explains a position sizing function that calculates lot size from the distance to a stop loss and a specified risk budget. Its example states that a 2% risk setting combined with a stop 40 points away yields a lot size intended to lose 2% of the deposit if price reaches that stop. The core idea is to scale trade size so the planned loss at the stop corresponds to a chosen share of account equity.

The text does not provide the calculation formula, contract or instrument assumptions, or details on how point value, currency conversion, commissions, slippage, or gaps are handled. It also offers no test results. The example should therefore be read as a description of intended sizing behavior, not a guarantee that realized losses will be capped at the target risk amount; actual fills and price movement can differ from the assumed stop execution.

Key ideas

  • The function sizes a lot using the distance to the stop loss and a chosen account risk share.
  • Its example links a 2% risk setting and a 40-point stop to a lot size targeting a 2% loss at the stop.
  • The description does not state how instrument value, costs, or currency conversion affect sizing.
  • Stop execution and market gaps can make realized losses differ from the intended risk budget.

Tags

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