Risk Guard Lite: A MQL5 EA for Controlled Risk Trading

Risk Guard Lite: A MQL5 EA for Controlled Risk Trading
Download ALL MT5 experts (1734)
YouTube Video Thumbnail



Similar MetaTrader Tools

Risk Guard Lite: A MQL5 EA for Controlled Risk Trading

Info

The Risk Guard Lite: A MQL5 EA for Controlled Risk Trading is a Expert Advisor for MetaTrader 5 that risk guard lite is a concise and understandable expert advisor demonstrating how to construct trades with managed risk in mql5. The entry logic is intentionally straightforward (an EMA crossover) to emphasize the critical components that often cause issues: stop loss placement, position sizing, and order validation.

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 Guard Lite: A MQL5 EA for Controlled Risk Trading

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 Guard Lite is a concise and understandable Expert Advisor demonstrating how to construct trades with managed risk in MQL5.

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: Prop Guard Lite: Daily and Max Loss Protection for Prop Firm Accounts - another powerful expert for MetaTrader 5 traders.

Risk Guard Lite is a concise and understandable Expert Advisor demonstrating how to construct trades with managed risk in MQL5. The entry logic is intentionally straightforward (an EMA crossover) to emphasize the critical components that often cause issues: stop loss placement, position sizing, and order validation.

Also recommended: Account Guard: EA Account Locking for MT5 - similar expert with strong performance on MetaTrader 5.


Functionality: On every new bar, the EA examines the two most recent closed bars for a crossover between the fast and slow Exponential Moving Averages (EMAs). The stop loss is set at a multiple of the Average True Range (ATR), ensuring it is never closer than the broker's minimum stop level. The take profit is determined by a fixed reward-to-risk ratio applied to the stop loss distance. The lot size is calculated using OrderCalcProfit to ensure that reaching the stop loss results in a loss of the specified percentage of equity, and is then adjusted to comply with the broker's volume step and limits. Prior to order submission, the EA verifies the spread and confirms the absence of any open positions for the associated magic number. It also logs the server return code in case of order rejection.

Inputs: Fast EMA Period (20), Slow EMA Period (50), ATR Period (14), Stop Loss Distance in ATR units (2.0), Take Profit Multiple of Stop Distance (1.5), Risk Percentage of Equity per Trade (0.5), Maximum Allowable Spread in Points (25), Maximum Slippage in Points (10), Magic Number.

Recommended Usage: Suitable for any liquid symbol on the H1 timeframe, such as EURUSD. Compatible with both netting and hedging account types. This EA serves as an educational framework rather than a complete trading strategy. Actual realized losses may differ from the set risk due to factors like commission, slippage, and market gaps. Profitability is not guaranteed. Please test thoroughly on a demo account before live trading.
It was last updated in 2026.

You may also like: Portfolio Weight Calculation: Risk Parity, HRP, Minimum Variance, and Maximum Diversification - excellent alternative for expert users on MetaTrader 5.

Source Code

#property copyright "RobotFX"
#property version   "1.00"
#property strict
#include <Trade/Trade.mqh>
input int      InpFastEmaPeriod   = 20;
input int      InpSlowEmaPeriod   = 50;
input int      InpAtrPeriod       = 14;
input double   InpStopAtrMultiple = 2.0;
input double   InpRewardRiskRatio = 1.5;
input double   InpRiskPercent     = 0.5;

.......

Leave your opinion, ask a question, share some knowledge

⚠ 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.
© ROBOTFX Free educational tools by RobotFX. Use entirely at your own risk; we are not liable for any financial losses incurred.