Supertrend G5 EA – Detailed User Guide for MetaTrader 5

22 June 2026, 04:16
Van Minh Nguyen
0
38

1. Introduction

Supertrend G5 is a fully automated Expert Advisor (EA) for the MetaTrader 5 platform, developed by Van Minh Nguyen. The EA is specifically optimized for XAUUSD on the M5 timeframe, but it can also be applied to major forex pairs (EURUSD, USDJPY, GBPUSD) and cryptocurrencies (BTC...) with appropriate parameter adjustments.

1.1 Core Trading Strategy

The EA executes trades based on signals from the Supertrend indicator:

BUY: when Supertrend switches from a downtrend to an uptrend (reversal from Down → Up)
SELL: when Supertrend switches from an uptrend to a downtrend (reversal from Up → Down)

1.2 Key Features

EMA filter (short-term and long-term) for trend confirmation
Higher timeframe trend filter (HTF EMA)
Spread filtering before order execution
Flexible position management (close opposite trades on new signal)
Limits on number of orders and total lot exposure
Risk management based on account equity percentage
Single-chart operation mode
Account protection with maximum drawdown limit (50%)
Real-time dashboard monitoring

2. Installation Guide

2.1 Installation Steps

Download the EA file (.ex5)
Open MetaTrader 5 → File → Open Data Folder
Navigate to: MQL5 → Experts
Copy the EA file into the Experts folder
Restart MT5 or refresh Navigator (press F5)
Drag and drop the EA onto a chart
Enable AutoTrading → Click OK

2.2 Recommended Settings

Symbol: XAUUSD
Timeframe: M5
Minimum Deposit: From 1,000 USD
Leverage: Up to 1:500
Account Type: ECN or low spread


3. Input Parameters Explained


3.1 Single Chart Settings

EnableSingleChartOperation: Enable EA to operate only on specified chart (default: false)
OperatingSymbol: Allowed trading symbol (default: XAUUSD)
OperatingTimeframe: Allowed timeframe (default: M5)

Note: When enabled, the EA only operates if the current chart matches both symbol and timeframe. This helps prevent duplicate trades across multiple charts.


3.2 Supertrend Core Settings

AtrPeriod: ATR period controlling sensitivity (default: 14)
Multiplier: ATR multiplier (higher = fewer signals) (default: 2.0)
Lots: Base lot size (default: 0.01)
Slippage: Allowed slippage in points (default: 3)
StopLossPoints: Stop Loss in points (0 = disabled) (default: 0)
TakeProfitPoints: Take Profit in points (0 = disabled) (default: 5000)
CloseOpposite: Close opposite position on new signal (default: true)

Supertrend logic:
Supertrend uses ATR to determine trend direction.

Price above green line → Uptrend
Price below red line → Downtrend


3.3 Trade Direction Settings

EnableBuy: Allow buy orders (default: true)
EnableSell: Allow sell orders (default: true)


3.4 Max Orders Settings

MaxAllOrders: Maximum number of open orders (default: 3)
MaxLotSum: Maximum total lot size (default: 10)

Important note:
For Netting accounts, MaxAllOrders is automatically limited to 1 since only one position per symbol is allowed.


3.5 EMA Filter Settings

UseEMATrendFilter: Enable EMA filter (default: true)
EMA_ShortPeriod: Short EMA period (default: 50)
EMA_LongPeriod: Long EMA period (default: 200)
TF_EMA: EMA timeframe (default: Current)

Logic:
BUY when EMA short > EMA long (bullish trend)
SELL when EMA short < EMA long (bearish trend)


3.6 Spread Filter Settings

UseSpreadCheck: Enable spread filter (default: false)
MaxSpreadPoints: Maximum allowed spread (default: 200)


3.7 Higher Timeframe Trend Filter

UseHTFTrendFilter: Enable HTF filter (default: true)
HTF_Trend_Frame: Higher timeframe (default: D1)
HTF_EMA_Period: EMA period on HTF (default: 200)

Logic:
BUY when Price > EMA200 on D1
SELL when Price < EMA200 on D1


3.8 Trading Hours Settings

UseTradingHours: Enable trading session filter (default: false)
TradingSessionStartHour: Start hour (default: 12)
TradingSessionStartMin: Start minute (default: 0)
TradingSessionEndHour: End hour (default: 17)
TradingSessionEndMin: End minute (default: 0)

Note: Overnight trading sessions are supported (e.g., 22:00–02:00).


3.9 Risk Management

MaxRiskPercent: Risk per trade (%) (default: 2.0)
UseMoneyManagement: Enable dynamic lot sizing (default: false)

Lot calculation depends on:
Account balance
MaxRiskPercent
Stop Loss distance


3.10 Dashboard Settings

EnableDashboard: Enable dashboard display (default: false)
DashboardCorner: Position (Left upper)
DashboardX: X offset (default: 10)
DashboardY: Y offset (default: 20)
DashboardFont: Font (default: Arial)
DashboardFontSize: Size (default: 10)
DashboardTextColor: Text color (default: White)
DashboardBgColor: Background (default: DarkSlateGray)
DashboardProfitColor: Profit color (default: Lime)
DashboardLossColor: Loss color (default: Red)


3.11 Common Settings

MagicNumber: EA identifier (default: 20252606)

MagicNumber is used to distinguish this EA’s trades from other EAs or manual trades.


4. Dashboard Overview

When EnableDashboard = true, the EA displays real-time data including:

EA Status (RUNNING / MAX LOSS / OUT OF HOURS / HIGH SPREAD)
Current spread
Lot size
Balance
Equity
Free margin
Margin level
Today’s profit
Open orders (Buy/Sell)
Last signal


5. Account Protection Features

5.1 Maximum Loss Limit (50%)

The EA monitors a maximum drawdown limit of 50%:

Loss threshold = Initial balance × 50%

When Equity ≤ threshold:

All positions are closed immediately
EA stops trading
Dashboard displays: “MAX LOSS REACHED”


6. Important Usage Notes

6.1 Account Types

Hedging: allows multiple positions (Buy & Sell simultaneously)
Netting: only one position per symbol → EA enforces MaxAllOrders = 1

6.2 Pre-Trade Checks

Ensure:
Sufficient margin available
Spread is within allowed limit (if enabled)
Trading time is valid (if enabled)

6.3 Optimization Tips

Lower AtrPeriod → more sensitive signals
Higher Multiplier → fewer but safer signals
Adjust parameters when trading non-XAUUSD symbols for optimal performance


7. Troubleshooting

EA does not open trades → Check EnableBuy/EnableSell, trading hours, and spread filter
"Not enough money" error → Increase balance or reduce lot size
Dashboard not showing → Enable EnableDashboard
EA not working → Check symbol/timeframe and single-chart mode
"Maximum Loss Limit Breached" → Deposit more funds or reset EA on a new chart


8. Conclusion

Supertrend G5 is a powerful trend-following EA built around the Supertrend indicator, combined with multiple professional filters and risk management modules. With features such as a real-time dashboard, account protection, and flexible configuration, it is suitable for both beginner and advanced traders.

Final Recommendations

Always backtest before live trading
Start with a demo account
Monitor dashboard metrics carefully during live trading