Home System Trading Post

Mastering the Exp_ColorX2MA_X2 EA for MetaTrader 5: Your Ultimate Guide

Attachments
21001.zip (44.56 KB, Download 0 times)

If you're looking for a reliable trend-following trading system, the Exp_ColorX2MA_X2 could be just what you need. This EA uses two indicators—ColorX2MA—to help you navigate the markets with confidence. Here's how it works:

The first indicator identifies the direction of the slow trend based on its color. The second indicator signals when it’s time to open a trade, which happens when there’s a change in the line’s color. A trading signal is generated at the close of a bar if two conditions are met:

  • The fast and slow trend signals align.
  • The direction of the fast trend changes.

Input Parameters for the Expert Advisor

//+-------------------------------------------------+
//| Input parameters of the EA indicator            |
//+-------------------------------------------------+
sinput string Trade="Trade Management";    //+============== TRADE MANAGEMENT ==============+
input double MM=0.1;               //Share of a deposit in a deal
input MarginMode MMMode=LOT;      //Lot value detection method
input uint    StopLoss_=1000;      //Stop Loss in points
input uint    TakeProfit_=2000;    //Take Profit in points
sinput string MustTrade="Trade Permissions";    //+============== TRADE PERMISSIONS ==============+
input int    Deviation_=10;       //Max price deviation in points
input bool   BuyPosOpen=true;     //Permission to enter long positions
input bool   SellPosOpen=true;    //Permission to enter short positions
//+-------------------------------------------------+
//| Input parameters of the filter indicator        |
//+-------------------------------------------------+
sinput string Filter="SLOW TRADE PARAMETERS"    //+============== TRADE PARAMETERS ==============+
input ENUM_TIMEFRAMES TimeFrame=PERIOD_H6;  //1 Chart period for the trend
input Smooth_Method MA_Method1=MODE_SMA_; //first-smoothing averaging method 
input uint Length1=12; //first smoothing depth                    
input int Phase1=15; //first smoothing parameter,
3//---- for JJMA within the range of -100 ... +100 it influences the quality of the transition process;
//---- for VIDIA it is a CMO period, for AMA it is a slow average period
input Smooth_Method MA_Method2=MODE_JJMA; //second-smoothing averaging method 
input uint Length2= 5; //second smoothing depth 
input int Phase2=15;  //second smoothing parameter,
3//---- for JJMA within the range of -100 ... +100 it influences the quality of the transition process;
//---- for VIDIA it is a CMO period, for AMA it is a slow average period
input Applied_price_ IPC=PRICE_CLOSE_;//price constant                  
input uint SignalBar=1; //Bar index to get receive signal
input bool   BuyPosClose=true;     //Permission to exit long positions by trend
input bool   SellPosClose=true;    //Permission to exit short positions by trend
//+-------------------------------------------------+
//| Input parameters of the entry indicator         |
//+-------------------------------------------------+
sinput string Input="ENTRY PARAMETERS"       //+=============== ENTRY PARAMETERS ===============+
input ENUM_TIMEFRAMES TimeFrame_=PERIOD_M30;  //2 Chart period for entry
input Smooth_Method MA_Method1_=MODE_SMA_; //first-smoothing averaging method 
input uint Length1_=12; //first smoothing depth                    
input int Phase1_=15; //first smoothing parameter,
3//---- for JJMA within the range of -100 ... +100 it influences the quality of the transition process;
//---- for VIDIA it is a CMO period, for AMA it is a slow average period
input Smooth_Method MA_Method2_=MODE_JJMA; //second-smoothing averaging method
input uint Length2_= 5; //second smoothing depth 
input int Phase2_=15;  //second smoothing parameter,
3//---- for JJMA within the range of -100 ... +100 it influences the quality of the transition process;
//---- for VIDIA it is a CMO period, for AMA it is a slow average period
input Applied_price_ IPC_=PRICE_CLOSE_;//price constant 
input uint SignalBar_=1;//Bar index to receive an entry signal
input bool   BuyPosClose_=false;     //Permission to exit long positions by signal
input bool   SellPosClose_=false;    //Permission to exit short positions by signal
//+-------------------------------------------------+

The string parameters in the input parameters code simply enhance the visualization of the EA's settings window.

It's worth noting that the ColorX2MA_HTF indicators included in the EA are designed solely for better trend visualization in the strategy tester and won’t be active in other operating modes.

To ensure your EA runs smoothly, make sure the compiled files for the indicators ColorX2MA.ex5 and ColorX2MA_HTF.ex5 are placed in the <terminal_data_directory>\MQL5\Indicators folder.

The TradeAlgorithms.mqh library file allows you to use Expert Advisors with brokers offering nonzero spreads and the ability to set Stop Loss and Take Profit simultaneously with position opening. You can download more library variants via this link: Trade Algorithms.

During the tests shown below, we used the default input parameters of the Expert Advisor. No Stop Loss or Take Profit settings were applied during these tests.


Here are the testing results for USDJPY over the year 2016, utilizing a slow trend on H6 and entry based on a fast trend on M30:

Fig 1. Examples of deals on the chart

Fig 1. Examples of deals on the chart

Fig. 2. Testing results chart

Fig. 2. Testing results chart

Related Posts

Comments (0)