Expert Advisor: Traffic Light Trend Strategy

Expert Advisor: Traffic Light Trend Strategy
Download ALL MT4 experts (893)
YouTube Video Thumbnail



Similar MetaTrader Tools

Expert Advisor: Traffic Light Trend Strategy

Info

The Expert Advisor: Traffic Light Trend Strategy is a Expert Advisor for MetaTrader 4 that a trend strategy based on moving averages with colors mimicking a traffic light. The purpose of this EA is to test the strategy on historical data and identify optimal parameters.

Usage

This tool is typically used for trend following strategies across multiple currency pairs.

Platform

This Expert Advisor works exclusively on MetaTrader 4 (both build 600+ and newer versions).

Setup

Place the downloaded file in MQL4/Experts folder via File ? Open Data Folder in MetaTrader 4.


How to Install and Use Expert Advisor: Traffic Light Trend Strategy

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

A trend strategy based on moving averages with colors mimicking a traffic light.

Typical Use Case

This Expert Advisor excels in trend following on MetaTrader 4.

Compatible Platform & Setup

This Expert Advisor works on MetaTrader 4. Place the file in the MQL4/Experts folder and restart the terminal.

Description & Settings

Related: e-trailing2: enhanced trailing stop expert advisor - another powerful expert for MetaTrader 4 traders.

A trend strategy based on moving averages with colors mimicking a traffic light. The purpose of this EA is to test the strategy on historical data and identify optimal parameters.

Also recommended: e-signal of trade expert advisor - similar expert with strong performance on MetaTrader 4.


The strategy utilizes a single indicator: Moving Average, with five distinct parameters:

Red: Period 120, Method Simple, Apply to Close.
Yellow: Period 55, Method Simple, Apply to Close.
Green: Period 5, Method Exponential, Apply to Close.
Blue Dotted: Period 24, Method Exponential, Apply to High.
Brown Dotted: Period 24, Method Exponential, Apply to Low.

A buy signal is generated when the moving averages align from top to bottom in the order: Green, Yellow, Red.
A sell signal is generated when the indicators align in the reverse order: Red, Yellow, Green.
Additionally, the price must be outside the corridor formed by the Blue and Brown dotted moving averages.

Trade Execution:
The EA opens trades according to the defined strategy. Take Profit and Stop Loss levels are set in the initial parameters.
Trades can be opened in two modes: matching all signals on the current candlestick or at the beginning of the next candlestick, determined by the 'timeopenbar' parameter.
Trades are closed by Take Profit, Stop Loss, or when the Green and Yellow moving averages intersect. Closing the trade upon intersection is controlled by the 'closeprofit' parameter and can occur on the current or next candlestick, determined by the 'timeclosebar' parameter.

Timing of Signal Capture:
The setting for triggering events on the current candlestick versus the next candlestick significantly impacts test result quality. This distinction determines whether signals are accepted based on current moving average positions or as historical facts. Moving averages can redraw and produce false signals before a candlestick closes.

Trading Style:
The 'trading style' mode, defined by the 'styletrade' parameter, influences the number of positions opened by the EA.
Aggressive Trading: Opens a new deal after the price enters the corridor between the Blue and Brown averages.
Conservative Trading: Opens a new deal after the price enters the corridor between the Red and Yellow averages.

All parameters can be enabled or disabled using numerical values: 0 for off, 1 (or any non-zero number) for on. This facilitates EA testing within the Strategy Tester.

Risk Management:
Standard lot size calculation based on selected risk is included.

Further details regarding the expert advisor's settings and their impact on test results are available in the provided video.

Recommended Timeframe: H1.
The EA has demonstrated positive performance on GBPUSD, EURUSD, and EURGBP currency pairs in the market as of 2026.

Example Test on GBPUSD pair:
Example Test on EURGBP pair:
The EA can potentially trade without Stop Loss and/or Take Profit when 'closeprofit' is enabled, allowing capture of up to 70% of trend movement. Example Test on EURUSD pair without Take Profit and Stop Loss:

Important Considerations:

This is not an automated 'set and forget' trading robot.

Position opening sequence: Price enters the specified corridor (based on 'styletrade' parameter) — price exits the corridor — signals align — position opened.

On certain currency pairs or under different market volatility conditions, the EA may result in the loss of the entire deposit.

Potential Improvements:

You may also like: e-news-lucky$ - automated news trading expert advisor - excellent alternative for expert users on MetaTrader 4.

Source Code

#property copyright "robotfx"
#property link "https://robotfx.org"
#property version   "1.0"
#property strict
extern string s1=" mm   ";
extern double      mm_lots            = 0.1;    //   mm
extern int         mm_mode            = 1;      // 0 mm  1  
extern int         lotsdecimal        = 1;      //   0/1/2   
extern double      riskpercent        = 1;      //   
extern int         magicnumber        = 134201; //   

.......

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.