Expert Advisors • Indicators • Scripts • Libraries

MQL.RobotFX.org is the biggest collection of MetaTrader expert advisors (MT5 & MT4), indicators, scripts and libraries that can be used to improve trading results, minimize risks or simply automate trading tasks

MetaTrader 4 Expert Advisor | EMAplusWPR

ACTUAL VERSION : http://codebase.mql4.com/en/code/10413

Expert advisor that trade in the trend of EMA and buy/sell signals get from Williams %R

I have tried to create an Expert advisor that could by traded with 1000 EUR starting equity and to minimize the drawdown. Hope you like it. I appreciate every feedback.

Inputs EMA, iWPRPeriod are optimized for EURUSD 5M

TakeProfit = 200;

maxStopLoss=50;

maxLots = 0.1; // max lots per position

maxContracts = 2; // max open positions, 2 is optimal for smoother equity

EMA=144; // EMA to determine trend

iWPRPeriod=46; // Williams' Percentage Range to determine buy/sell signals

Test is without position sizing, 0.1 lot size

Strategy Tester Report
EMAplusWPR
XTrade-MT4 Demo (Build 225)

SymbolEURUSD (Euro vs US Dollar)
Period5 Minutes (M5) 2010.01.04 00:00 - 2011.02.01 23:55 (2010.01.01 - 2011.02.02)
ModelEvery tick (the most precise method based on all available least timeframes)
ParametersTakeProfit=200; maxStopLoss=50; maxLots=0.1; maxContracts=2; EMA=144; iWPRPeriod=46;
Bars in test59026Ticks modelled7365768Modelling qualityn/a
Mismatched charts errors8220
Initial deposit1000.00
Total net profit1624.88Gross profit4601.32Gross loss-2976.44
Profit factor1.55Expected payoff3.90
Absolute drawdown27.02Maximal drawdown331.92 (13.99%)Relative drawdown13.99% (331.92)
Total trades417Short positions (won %)198 (71.21%)Long positions (won %)219 (75.80%)
Profit trades (% of total)307 (73.62%)Loss trades (% of total)110 (26.38%)
Largestprofit trade45.15loss trade-39.67
Averageprofit trade14.99loss trade-27.06
Maximumconsecutive wins (profit in money)20 (273.90)consecutive losses (loss in money)5 (-118.47)
Maximalconsecutive profit (count of wins)326.41 (15)consecutive loss (count of losses)-153.43 (4)
verageconsecutive wins5consecutive losses2
MetaTrader Experts, Indicators, Scripts and Libraries

To use my position sizing increase the maxLots size

For position sizing I use the following code:

Ilo=0.1* MathSqrt((AccountBalance()) / 300);

Lots=NormalizeDouble(Ilo, 1);

if (Lots<0.1) Lots=0.1;

if (Lots>maxLots) Lots=maxLots;

Strategy Tester Report
EMAplusWPR + position sizing
XTrade-MT4 Demo (Build 225)

SymbolEURUSD (Euro vs US Dollar)
Period5 Minutes (M5) 2010.01.04 00:00 - 2011.02.01 23:55 (2010.01.01 - 2011.02.02)
ModelEvery tick (the most precise method based on all available least timeframes)
ParametersTakeProfit=200; maxStopLoss=50; maxLots=5; maxContracts=2; EMA=144; iWPRPeriod=46;
Bars in test59026Ticks modelled7365768Modelling qualityn/a
Mismatched charts errors8220
Initial deposit1000.00
Total net profit4629.01Gross profit14103.33Gross loss-9474.32
Profit factor1.49Expected payoff11.10
Absolute drawdown54.04Maximal drawdown1293.48 (27.32%)Relative drawdown27.32% (1293.48)
Total trades417Short positions (won %)198 (71.21%)Long positions (won %)219 (75.80%)
Profit trades (% of total)307 (73.62%)Loss trades (% of total)110 (26.38%)
Largestprofit trade176.09loss trade-154.73
Averageprofit trade45.94loss trade-86.13
Maximumconsecutive wins (profit in money)20 (547.80)consecutive losses (loss in money)5 (-554.73)
Maximalconsecutive profit (count of wins)1237.52 (15)consecutive loss (count of losses)-554.73 (5)
Averageconsecutive wins5consecutive losses2

MetaTrader Experts, Indicators, Scripts and Libraries

10116

Best MetaTrader Indicators + Profitable Expert Advisors