Skip to content
All library documents

Cross-Currency Pip Valuation and Stop-Based Position Sizing in MQL5

Article MQL5 code base

Summary

The document describes an MQL5 utility for calculating pip values and position sizes from a target account-currency risk and stop-loss distance. It addresses cross-currency instruments by first using the platform’s symbol tick-value and tick-size properties, then falling back to currency-pair extraction and conversion-rate lookups when broker values are missing or uninitialized. It also detects the account’s base currency and adjusts calculated volume to the broker’s minimum, maximum, and step constraints.

The stated method links the cash amount at risk to pip value and stop distance to determine a lot size, and includes a small integration example and a summary of the class methods. The document does not present validation results, edge-case analysis, or evidence that the fallback conversion handles every symbol convention or broker setup. Users would need to verify conversions, pip definitions, and volume constraints for their instruments and account before relying on the output.

Key ideas

  • The calculator estimates pip value in the account currency and lot size from a risk amount and stop distance.
  • It prioritizes broker-provided tick properties and uses manual currency conversion as a fallback.
  • It detects the account currency and constrains volumes to broker limits and increments.
  • The document offers integration guidance but provides no test results or validation evidence.
  • Correct use depends on checking instrument conventions and broker data behavior.

Tags

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