ST Risk Calculator
A free MetaTrader 4 Expert Advisor with on-chart risk calculator, ATR-based stop loss & take profit, and one-click trade execution.
Free Download MT4 EA v2.02
What Does It Do?
A draggable on-chart panel that calculates your position size, stop loss, and take profit based on ATR — then lets you execute the trade with one click.
ATR-Based Levels
Stop loss and take profit are calculated from the 14-period ATR plus spread. No guesswork — everything is based on actual volatility.
2% Risk Sizing
Automatically calculates the correct lot size so you never risk more than 2% of your account balance on any single trade.
One-Click Execution
Click EXECUTE BUY or EXECUTE SELL and the EA opens the trade with the calculated lot size, stop loss, and take profit — all set automatically.
Panel Overview
When you attach the EA to any chart, a dark panel appears showing real-time calculations. Here is what each field means:
| Field | Description |
|---|---|
| ATR(14) | The 14-period Average True Range in pips. This measures the pair’s recent volatility. |
| Spread | Current broker spread in pips, included in all SL/TP calculations. |
| Direction | BUY or SELL — click the buttons at the top to switch. |
| Entry | The entry price (Ask for BUY, Bid for SELL). |
| Stop Loss | Calculated as: 0.5 × ATR + spread from entry. |
| Take Profit | Calculated as: 3 × ATR + spread from entry. |
| SL Pips | Stop loss distance in pips. |
| TP Pips | Take profit distance in pips. |
| Lot Size | Position size calculated from your risk % and SL distance. Rounded down to your broker’s lot step. |
| Risk | Actual dollar risk and percentage after lot rounding. May be less than 2% if lot hits the 0.01 minimum. |
| R:R Ratio | Reward-to-risk ratio. Default settings give approximately 1:5.7. |
How to Install
Step 1 — Download the file ST_RiskCalc.mq4
Step 2 — Open MetaTrader 4 and go to File → Open Data Folder
Step 3 — Navigate to MQL4/Experts/ and paste the file there
Step 4 — Back in MT4, open the Navigator panel (Ctrl+N)
Step 5 — Right-click on Expert Advisors and click Refresh
Step 6 — Drag ST_RiskCalc onto any chart
How to Use
1. Choose Direction
Click the BUY or SELL button at the top of the panel. All values update instantly and horizontal lines (Entry, SL, TP) are drawn on the chart.
2. Review the Calculation
Check the lot size, SL/TP prices, and actual risk amount. The panel updates on every tick so values always reflect the latest price.
3. Execute the Trade
When you are ready, click the EXECUTE BUY or EXECUTE SELL button. The EA will:
- Open the position at market price
- Set the stop loss and take profit automatically
- Show a confirmation in the status line (ticket number and fill price)
- Play a sound on success
4. Move the Panel
Click and drag the title bar (the dark bar at the top that says “ST Risk Calculator”) to reposition the panel anywhere on the chart.
5. Clear Lines
Click Clear Lines to remove the Entry/SL/TP horizontal lines from the chart.
Default Settings
| Setting | Default | Description |
|---|---|---|
| ATR Period | 14 | Number of bars for ATR calculation |
| Risk Percent | 2.0% | Percentage of account balance to risk per trade |
| SL ATR Multiplier | 0.5 | Stop loss = this × ATR + spread |
| TP ATR Multiplier | 3.0 | Take profit = this × ATR + spread |
| ATR Timeframe | Current chart | Timeframe for ATR calculation (can use H4 on M5 chart, etc.) |
| Slippage | 2.0 pips | Maximum allowed slippage for order execution |
| Magic Number | 20260211 | Unique identifier for this EA’s trades |
All settings can be changed via F7 (EA Properties → Inputs tab) while the EA is running.
How the Math Works
SL & TP Formulas
Stop Loss Distance = 0.5 × ATR(14) + Spread
Take Profit Distance = 3 × ATR(14) + Spread
For a BUY: SL = Ask − SL Distance, TP = Ask + TP Distance
For a SELL: SL = Bid + SL Distance, TP = Bid − TP Distance
Lot Size Formula
Risk Amount = Account Balance × 2%
Lot Size = Risk Amount ÷ (SL in points × Tick Value)
The result is rounded down to your broker’s lot step and clamped between the minimum and maximum lot size.
Why Use ATR for Stop Loss & Take Profit?
Fixed Pips = Bad
A 20-pip stop loss might be perfect for EURUSD but suicidal for GBPJPY. Fixed pip values ignore how much the pair actually moves.
ATR = Adaptive
ATR measures real volatility. When markets are calm, your SL is tighter. When markets are wild, your SL widens to avoid noise. Same logic, every pair, every session.
Frequently Asked Questions
Why is my lot size stuck at 0.01?
Your account balance is too small relative to the SL distance. The calculated lot comes out below the broker’s minimum (0.01), so it gets floored up. The Risk line shows your actual risk after this rounding — it will be below 2%. This is not a bug, it is your broker’s minimum lot size limit.
I get “AutoTrading is disabled” when I click Execute
Click the AutoTrading button in the MT4 toolbar (top of the screen). The icon should be green, not red. Also check that “Allow live trading” is ticked in the EA properties (press F7 → Common tab).
I get “Trade context busy – try again”
Another EA on the same MT4 is currently executing a trade. MT4 only allows one trade operation at a time. Wait a moment and click Execute again.
Can I use this on multiple charts at the same time?
Yes. Each chart gets its own panel and calculations. The Magic Number input (default: 20260211) identifies this EA’s trades. If you want to track trades separately per chart, give each instance a different Magic Number in the Inputs tab.
Can I change the SL/TP multipliers?
Yes. Press F7 while the EA is on the chart, go to the Inputs tab. Change SL_ATR_Mult (default 0.5) and TP_ATR_Mult (default 3.0) to whatever you like. For example, SL_ATR_Mult = 1.0 gives a wider stop, TP_ATR_Mult = 2.0 gives a closer target.
Does this EA trade automatically?
No. This is a manual trade tool. It only opens trades when you click the Execute button. It does not scan for signals or trade on its own.
Why does the panel cover the candles?
The EA sets chart bars to draw behind panel objects so the panel text is readable. When you remove the EA from the chart, the original chart setting is restored. You can also drag the panel to a less obstructive position by clicking and dragging the title bar.
What pairs and instruments does this work on?
Any instrument available in your MT4: forex pairs, gold (XAUUSD), silver (XAGUSD), indices, etc. The ATR and lot calculations adapt automatically to any symbol’s tick value, point size, and lot specifications.
Risk Warning
Trading forex and CFDs involves substantial risk of loss. This tool helps with position sizing and trade execution but does not guarantee profits. Always trade with money you can afford to lose. Past performance is not indicative of future results. You are solely responsible for your trading decisions.