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 | //+-------------------------------------------------+ sinput string Trade="Trade Management"; //+============== TRADE MANAGEMENT ==============+ input double MM=0.1; //Share of a deposit in a deal input MarginMode MMMode=LOT; //lot size 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 uint Length=7; // smoothing depth input Applied_price_ IPC=PRICE_CLOSE_; // price constant input uint SignalBar=1; // bar number for getting the entry signal input bool BuyPosClose=true; // Permission to close long positions by trend input bool SellPosClose=true; // Permission to close 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 uint Length_=7; // smoothing depth input Applied_price_ IPC_=PRICE_CLOSE_; // price constant input uint SignalBar_=1; // bar number to get an entry signal input bool BuyPosClose_=false; // Permission to close long positions by signal input bool 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