Gold Linear Alpha EA
- Experts
- Andreas Smigadis
- Versione: 1.0
- Attivazioni: 5
Overview
Gold Linear Alpha EA is an automated Expert Advisor for MetaTrader 4 designed for XAUUSD (Gold) on the H1 timeframe.
It combines a Linear Regression directional bias with limit entries around a LWMA(50) reference level.
Entry spacing adapts to volatility using Bollinger Band Width from a higher-period band.
Trades use fixed Stop Loss and Take Profit, with an optional fixed trailing stop (when enabled).
The EA is designed without martingale and without grid-style averaging.
What the EA Does
The EA evaluates directional bias by comparing price to a Linear Regression line (period 14).
When the bias is defined, it prepares pending limit orders around LWMA(50) with an adaptive offset.
The offset is scaled using Bollinger Band Width from BB(138, 2.1) and the EntryMultiplier input.
If a pending order is not triggered within the specified number of H1 bars, it expires and is removed.
Once in a trade, the EA manages positions using fixed SL/TP and can apply a fixed trailing stop if enabled.
Duplicate entries are controlled through MagicNumber logic.
Key Features
-
Designed for XAUUSD on H1 (MT4)
-
Linear Regression (14) bias for long/short posture
-
LWMA(50) reference with volatility-adaptive limit entries
-
Bollinger Band Width scaling from BB(138, 2.1) via EntryMultiplier
-
Fixed Stop Loss / Take Profit per position
-
Optional fixed trailing stop (when enabled)
-
Pending order expiry after a defined number of bars
-
No martingale and no grid-style averaging
Risk Management & Safety Notes
Trading involves risk, and losses are possible. This EA does not guarantee results.
Gold can be volatile; spread widening, slippage, and gaps may affect entries and exits.
Pending limit orders may be rejected due to broker stop/freeze level restrictions or trading conditions.
Fixed SL/TP and trailing settings should be verified for your broker’s XAUUSD specifications (digits, contract size, margin).
Use conservative position sizing and set your own daily/account loss limits.
Always test in Strategy Tester (historical simulation) and then on a demo account before using a live account.
Inputs
Trading & Sizing
-
MagicNumber: trade identifier for this EA instance
-
RiskPercent: percentage-based sizing (if supported in your build)
-
FixedLot: fixed lot sizing option (if used)
-
Safety caps (if included in your build)
Signals & Entries
-
LinearRegressionPeriod: 14
-
LWMA_Period: 50
-
BBWidthSource: BBPeriod 138 / BBDeviation 2.1
-
EntryMultiplier: 0.50
-
OrderValidityBars: 15 (H1 bars)
Exits & Management
-
StopLossPips: 1520
-
TakeProfitPips: 1715
-
TrailingStopPips: 900 (if enabled)
-
Session/weekend controls (if included)
Setup
-
Copy the EA file to MQL4/Experts and restart MT4 (or refresh Navigator).
-
Open XAUUSD (broker suffixes may apply) and set timeframe to H1.
-
Attach the EA to the chart and enable AutoTrading.
-
Set MagicNumber (recommended if running multiple EAs or instances).
-
Choose RiskPercent or FixedLot and start with conservative values.
-
Confirm SL/TP, trailing option, and OrderValidityBars match your intended risk and holding window.
Recommended Evaluation
Run Strategy Tester as a historical simulation to confirm pending order placement, expiry behavior, and SL/TP handling.
Use your broker’s XAUUSD symbol settings (digits, contract size, minimum stops, spread model).
Forward-test on a demo account to observe live execution effects such as spread changes and slippage.
Test across different volatility phases rather than a short date range.
Adjust one group of settings at a time (entries, then exits, then sizing) and document your changes.
Compatibility
Platform: MetaTrader 4 (MT4).
Symbol: intended for XAUUSD (Gold); broker naming may include suffixes (e.g., XAUUSDm).
Timeframe: designed for H1; other timeframes require your own re-evaluation.
The terminal must remain running for trailing stop and order expiry management.
FAQ
Q: Does it use martingale or grid averaging?
A: No. The EA is designed without martingale and without grid-style averaging.
Q: Why did a pending order disappear?
A: Pending orders can expire after OrderValidityBars if not triggered.
Q: Can I use it on other symbols?
A: It is intended for XAUUSD. Other symbols require your own testing and parameter adjustment.
Q: Does trailing work if MT4 is closed?
A: No. Trailing and active management require the terminal to remain running.
Q: Why were orders rejected?
A: Common causes include broker stop/freeze level restrictions, insufficient margin, or trading permissions.
Q: How do I get support?
A: Support is provided via MQL5 comments or MQL5 messages only.
Changelog
v1.00
-
Initial release: Linear Regression bias, LWMA limit entries with BB width scaling, fixed SL/TP, trailing option, and pending expiry.
