Risk Math Toolkit
- 라이브러리
- 버전: 1.0
What this library answers
Compiled library for MetaTrader 5 (MT5).
How much should this trade really risk? Most people work it out by hand and get the answer wrong on gold, on an index and on a small account.
Risk Math Toolkit is a compiled library of pure arithmetic functions. No trading, no orders, no files and no chart objects, because every function takes numbers and returns a number. Import the ones you need and call them inside your own Expert Advisor, indicator, script or optimisation pass.
- RM_Lots: the lot size that risks a fixed share of an account at a given stop distance.
- RM_RiskForLots: the money that lot size risks at that distance.
- RM_RequiredWinRate: the win rate a reward multiple must beat to stay profitable.
- RM_ExpectedValue: the expectancy of a system in account money per trade.
- RM_CompoundBalance: the balance multiple after a run of trades at fixed fractional risk.
- RM_RewardMultiple, RM_StopForTarget, RM_NormalizeLots, RM_MarginLots and RM_Drawdown complete the set.
How to check it yourself
Write a one line script that prints RM_RequiredWinRate(1.8). You get 35.7 percent, and you can check it by hand: one win at 1.8 R against one loss breaks even at 1 divided by 2.8.
Setup
Copy the compiled file into MQL5/Libraries, or add RiskMathToolkit.mqh to your own source, and refresh the Navigator in the MetaTrader 5 terminal. The demo indicator that produced the screenshots is included with the listing so you can see every function called on live data.
Feedback and support
Your reviews tell the author which functions to add next, and a direct message on mql5.com reaches the author.
Copyright 2026, Saurabh Singh Parihar.
