Risk Position Size Calculator
Info
The Risk Position Size Calculator is a Expert Advisor for MetaTrader 5 that risk position size calculator — lot size from percentage risk, live on the chart a chart tool that turns a fixed percentage risk and a stop-loss level into an exact lot size, priced in your account currency. Drag the Entry and Stop lines, and the panel recalculates the position size, the money at risk, the required margin and the target level in real time.
Usage
This tool is typically used for automated trading on major forex pairs and gold.
Platform
This Expert Advisor works exclusively on MetaTrader 5 (both build 600+ and newer versions).
Setup
Place the downloaded file in MQL5/Experts folder via File ? Open Data Folder in MetaTrader 5.
How to Install and Use Risk Position Size Calculator
1. Installation: Open the "File" menu, select "Open Data Folder," navigate to MQL/Experts, paste your file, and restart the terminal.
2. Activation: Drag the EA from the Navigator onto a chart, ensure "Allow live trading" is checked in the Common tab, and verify the AutoTrading button is green.
3. Optimization: Right-click your chart, choose "Expert List," click "Properties" to adjust inputs, and save your preferred setup as a set file for future use.
4. Maintenance: Regularly check the "Experts" tab in the terminal window to monitor trade logs and potential execution errors.
Frequently Asked Questions
Q: Why is my EA not opening trades? A: Check the "AutoTrading" button, ensure "Allow live trading" is enabled, and verify your broker allows automated trading on your account type.
Q: Can I run multiple EAs on one chart? A: No, each chart can only host one active EA; however, you can open multiple charts for different currency pairs to run several EAs.
Q: What does the "smiley face" icon mean? A: A smiley face in the top-right corner of the chart indicates the EA is successfully running; a frowny face means it is disabled.
What this tool does
Risk Position Size Calculator — Lot Size From Percentage Risk, Live On The Chart A chart tool that turns a fixed percentage risk and a stop-loss level into an exact lot size, priced in your account currency.
Typical Use Case
This Expert Advisor excels in automated trading and technical analysis on MetaTrader 5.
Compatible Platform & Setup
This Expert Advisor works on MetaTrader 5. Place the file in the MQL5/Experts folder and restart the terminal.
Description & Settings
Related: Quantora Trade Manager MT5: Advanced Position Management - another powerful expert for MetaTrader 5 traders.
Risk Position Size Calculator — Lot Size From Percentage Risk, Live On The Chart
Also recommended: Quantora Position Size Calculator MT5: Professional Risk-Based Lot Size Calculation - similar expert with strong performance on MetaTrader 5.
A chart tool that turns a fixed percentage risk and a stop-loss level into an exact lot size, priced in your account currency. Drag the Entry and Stop lines, and the panel recalculates the position size, the money at risk, the required margin and the target level in real time. It calculates and displays only — it never sends, modifies or closes an order.Features
Risk-based position sizing
— set a risk percentage and the lot size is solved for you, not guessed.
Draggable Entry and Stop lines
— move either line and every number updates instantly, even on weekends when no ticks arrive.
Correct on any instrument
— the stop is priced with
OrderCalcProfit()
for one lot, so the result comes back in account currency with the broker's own conversion rate. The naive "points × tick value" shortcut silently drifts on cross pairs, metals and CFDs; this does not.
Money at risk shown in account currency
— the panel reports the exact amount you stand to lose, not just a percentage.
Required margin, reported not estimated
— margin comes straight from
OrderCalcMargin() , plus the free margin left after the trade.
Take-profit level for a chosen reward:risk
— set an R:R ratio and the target line and its cash value are drawn for you (set 0 to hide it).
Rounds volume DOWN to the broker's step
— rounding up would exceed the risk you declared, so it never does. If the result falls below the broker minimum, the panel says so explicitly instead of showing
0.00 .
Risk base selectable
— balance, equity or free margin.
Direction auto-detected
— stop below entry means buy, above means sell; or force buy/sell manually.
Configurable panel
— corner, font size and colours.
Single file, no dependencies, no external includes.
Compiles with 0 errors and 0 warnings.
How to use
Attach the EA to any chart. Two solid lines (Entry, Stop) and one dotted line (Target) appear, along with a panel in the corner.
Set
Risk per trade (%)
and the
risk base
(balance / equity / free margin) in the inputs.
Drag the
Stop
line to where your invalidation is. Leave
Entry
on the market price, or switch entry source to a line you place yourself.
Optionally set the
reward:risk
ratio — the Target line marks the matching take-profit level.
Read the panel:
Position size
is the lot to trade, alongside the money at risk, required margin and target profit.
Why use it
Fixed-lot trading means your loss in cash changes every time your stop distance changes — a tight stop risks too little, a wide stop risks too much, and the number is invisible until the trade is already open. Risk-based sizing inverts that: you decide the loss you accept in account currency, and the lot size follows the stop. Same risk on every trade, regardless of instrument or stop width.
Need a custom version or a full EA? Message me:
click here.
You may also like: Quantora Risk Calculator MT5 - Professional Trade Risk and Reward Calculator - excellent alternative for expert users on MetaTrader 5.
Source Code
#property copyright "RobotFX"
#property link "https://robotfx.org"
#property version "1.00"
#property description "This code is educational. Feel free to use, modify and upgrade as you wish. Visit ROBOTFX.ORG for professional trading tools"
#define OBJ_PREFIX "RPSC_"
#define NAME_ENTRY "RPSC_entry"
#define NAME_STOP "RPSC_stop"
#define NAME_TAKE "RPSC_take"
#define NAME_ROW "RPSC_row_"
#define NAME_BG "RPSC_bg"
.......
⚠ Limitations & Risk Warning
- This tool is provided for educational and testing purposes only.
- Past performance does not guarantee future results.
- Trading involves substantial risk of loss. Use on a demo account first.
- Results may vary depending on market conditions, broker, and settings.
- We recommend thorough backtesting and forward testing before using with real funds.