If you're on the lookout for a reliable trend-following trading system, you've landed in the right spot! Let me introduce you to the Absolutely No Lag LWMA X2, a powerful trading tool designed for MetaTrader 5 that leverages the signals from two nifty indicators, AbsolutelyNoLagLWMA.
The first indicator helps us spot the direction of the slow trend by analyzing the line color, while the second indicator provides the perfect moment to enter a trade, indicated by a line color change. A trading signal is generated when a bar closes, given that these two conditions are met:
- Fast and slow trend signals align;
- The direction of the fast trend shifts.
Input Parameters for the Trading System
//+-------------------------------------------------+//| Input parameters of the EA indicator |//+-------------------------------------------------+sinputstring Trade="Trade Management"; //+============== TRADE MANAGEMENT ==============+inputdouble MM=0.1; //Share of a deposit in a dealinput MarginMode MMMode=LOT; //lot size detection methodinputuint StopLoss_=1000; //Stop Loss in pointsinputuint TakeProfit_=2000; //Take Profit in pointssinputstring MustTrade="Trade Permissions"; //+============== TRADE PERMISSIONS ==============+inputint Deviation_=10; //Max price deviation in pointsinputbool BuyPosOpen=true; //Permission to enter long positionsinputbool SellPosOpen=true; //Permission to enter short positions//+-------------------------------------------------+//| Input parameters of the filter indicator |//+-------------------------------------------------+sinputstring Filter="SLOW TRADE PARAMETERS"; //+============== TRADE PARAMETERS ==============+inputENUM_TIMEFRAMES TimeFrame=PERIOD_H6; //1 Chart period for the trendinputuint Length=7; // smoothing depth input Applied_price_ IPC=PRICE_CLOSE_; // price constant inputuint SignalBar=1; // bar number for getting the entry signalinputbool BuyPosClose=true; // Permission to close long positions by trendinputbool SellPosClose=true; // Permission to close short positions by trend//+-------------------------------------------------+//| Input parameters of the entry indicator |//+-------------------------------------------------+sinputstring Input="ENTRY PARAMETERS" //+=============== ENTRY PARAMETERS ===============+inputENUM_TIMEFRAMES TimeFrame_=PERIOD_M30; //2 Chart period for entryinputuint Length_=7; // smoothing depth input Applied_price_ IPC_=PRICE_CLOSE_; // price constant inputuint SignalBar_=1; // bar number to get an entry signalinputbool BuyPosClose_=false; // Permission to close long positions by signalinputbool SellPosClose_=false; // Permission to close short positions by signal//+-------------------------------------------------+
Just a heads up: the string parameters in the input code are there to enhance the visualization of the input parameters window for the Expert Advisor.
The indicators AbsolutelyNoLagLwma_HTF included in the EA are only meant for better trend visualization in the Strategy Tester and won’t function in any other modes.
For everything to run smoothly, make sure that the compiled files of the indicators AbsolutelyNoLagLwma.ex5 and AbsolutelyNoLagLwma_HTF.ex5 are saved in your <terminal_data_directory>\MQL5\Indicators folder.
Also, keep in mind that the TradeAlgorithms.mqh library file allows you to use Expert Advisors with brokers who offer a nonzero spread and the flexibility to set Stop Loss and Take Profit simultaneously when opening a position. You can grab more versions of this library here.
The default input parameters of the Expert Advisor were used during the tests outlined below. Notably, Stop Loss and Take Profit settings were not applied during these tests.
Here are the testing results for USDJPY over the year 2016, using a slow trend on H6 and entering based on a fast trend on M30:

Fig 1. Examples of deals on the chart

Fig. 2. Testing results chart

Comments 0