Risk Calculator (MetaTrader indicator) — calculates the risk in form of a potential maximum loss that can be induced by the currently open positions and the active pending orders. The results are displayed as the money and percentage risk per currency pair and as the overall total risk in the separate chart window. You can regulate the work of the Risk Calculator by turning on or off swaps, spreads, and commission calculation. You can also tune the visual display parameters. The indicator is available for both MT4 and MT5.
Unlike the simple risk calculation procedure implemented as the module of the Position Size Calculator, this indicator will calculate proper risk values even in complex situations involving hedged trades, pending orders with intersecting stop-loss and take-profit levels, and even MT5's special stop-limit orders. The algorithm implements a brute force maximum potential loss search with some heuristic techniques to speed up the process. Therefore, traders will get fast calculation results on normal number of orders (up to about 20), but the execution speed will become unsatisfactory as the number of trades will increase. Nevertheless, the Risk Calculator indicator is a useful tool for assessing the exposure of the worst-case scenario when dealing with a complex portfolio of orders.
- CalculateSpreads (default = true) — if true, then potential loss due to spreads will become a part of the potential maximum loss.
- CalculateSwaps (default = false) — if true, then accrued swaps will become a part of the potential maximum loss.
- CommissionPerLot (default = 0) — your broker's commission per lot charged in account currency. Enter the value charged for one side of the trade, not round-turn.
- UseEquityInsteadOfBalance (default = false) — if true, then account equity is used instead of balance in calculations.
- cpFontColor (default = clrAzure) — font color for the currency pair names.
- mnFontColor (default = clrPaleGoldenrod) — font color for the risk in money form.
- pcFontColor (default = clrLimeGreen) — font color for the risk in percentage form.
- FontFace (default = "Courier") — font face of the displayed text.
- FontSize (default = 8) — font size of the displayed text.
- scaleY (default = 15) — number of pixels per line of output.
- offsetX (default = 20) — horizontal offset for output.
- offsetY (default = 20) — vertical offset for output.
Example of multiple pending orders and one position (limited loss risk)
Example of unprotected buy position (nearly unlimited loss risk)
Example of unprotected sell position (unlimited loss risk)
Despite being coded and tested to work in multiple scenarios, the Forex Risk Calculator has some limitations, restrictions and a potential for errors. Here is the list of the known issues with this indicator:
- When the account currency differs from the quote currency of the pair, for which the orders are placed and the risk is calculated, the results may be inaccurate due to unpredictable fluctuations of the conversion rate. For example, if your account is in JPY and you are trading EUR/USD, then the actual risk will also depend on the future USD/JPY rate. The Risk Calculator will not attempt to predict it.
- If trader creates too many pending orders with stop-loss and take-profit levels, the indicator may become too slow in its calculation or even stop functioning at all.
- If your broker offers variable spreads, the calculations will be somewhat inaccurate as the indicator assumes constant spreads on each tick.
- The indicator does not take into account the price slippage of pending orders' execution.
- The indicator ignores the lack of margin for order execution. It means that if you set up a pending order that will require more free margin than your account can provide, the Risk Calculator will still consider the possibility of that order's execution.
- The indicator does not take into account the correlation between different currency pairs. Risk value is calculated for each trading instrument separately. For example, if you buy EUR/USD and sell GBP/USD as a hedge, the indicator will calculate the risk of each position separately.
- The indicator does not take into account the triangular arbitrage and other forms of arbitrage with several currency pairs. For example, if you go long EUR/USD, long USD/JPY and short EUR/JPY, the Risk Calculator will treat those positions as three separate trades with their own risks.
Downloads (ver. 1.04, 2019-07-01)
Risk Calculator for MetaTrader 4
Risk Calculator for MetaTrader 5
Do you have any suggestions or questions regarding this indicator? You can always discuss Risk Calculator with the other traders and MQL programmers on the indicators forums.
1.04 - 2019-07-01
- Fixed a bug in MT5 version, which prevented compilation in newer MetaTrader 5 builds.
1.03 - 2017-07-22
- Added support for MetaTrader 5 Hedging mode.
- Fixed a bug with two or more positions with the same stop-loss or take-profit levels.
1.02 - 2016-11-11
- Fixed a compilation bug with pointer casting.
1.01 - 2015-05-01
1.00 - 2015-04-24
- First version of Risk Calculator indicator released.