MQL4 - automated forex trading   /  

Code Base

Read Financial Magazines in MetaTrader 4 and MetaTrader 5!

Code Base  Expert Advisors  EMAplusWPR_V2 To post a new code, please log in or register

Download MetaTrader 5 and visit Code Base
and Trade on the Go!
and Trade on the Go!
Couldn't find the right code? Order it in the Jobs section

This Expert Advisor is for
MetaTrader 4
Download MT 4 - 455 Kb

and Trade on the Go!

and Trade on the Go!

22.10.2011 22:41 barauskasjustin

> I see nothing free on your site

This line not my post but if you look here there are free source code EA's

And here are free compiled EA's, indis and tools

No email or registration required, just download



04.08.2011 10:51 BarrowBoy

Needs a Trading Hours filter as found in this LiveAlligator 101 - working example of an intraday/swing trading EA - original author is Rustein

Also ECN handling would be an idea and 'reliable order handling'



04.08.2011 00:58 BarrowBoy
Author: gery18 (2011.08.03 17:53)
Rating: 8.5
Downloaded: 20703
 EMAplusWPR_V_2.mq4 (12.1 Kb) View

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.

Optimized for EURUSD 5 min

I have removed some bugs, removed position sizing, add some inputs.

You use it on your own risk. I am not responsible for your loss, you have to change, test and optimize it for your purpose.

have not optimized it

old versions:


extern string    separator1 = "------trend settings------";
extern bool      useEMAtrend = true;               // trade in EMA trend
extern int       barsInTrend = 1;                  // how many bars should be in trend
extern double    EMAtrend = 144;                   // EMA period for trend

extern string    separator2 = "------WPR settings------";
extern double    iWPRPeriod = 46;                  // WPR period for enter and exit
extern double    iWPRRetracement = 30;             // minimal retracement for WPR to allow another trade
extern bool      useWPRExit = true;                // use exit with WPR indicator

extern string    separator3 = "------position settings------";
extern double    lots = 0.1;                       // fixed lot size
extern int       maxTrades = 2;                    // max trades allowed for pyramiding
extern double    stop_loss = 50;                   // stop loss
extern double    take_profit = 200;                // take profit
extern bool      useTrailingStop = false;          // use trailing stop
extern double    trailing_stop = 10;               // trail stop loss
extern bool      useUnprofitExit = false;          // exit trade when trade was not in profit in defined amount of bars
extern int       maxUnprofitBars = 5;              // amount of bars not in profit

7 comments  To post a new comment, please log in or register

Not bad, at least it doesn't crash to zero like many others noted 10 on this site !

Congrats !

26.02.2014 11:20 broketrader

i risultati esposti sono molto buoni.......h o scaricato, ma non riesco a farlo funzinare con i parametri default.......quancuno mi aiuta??'


27.07.2012 21:02 pasqui
Did you write this Code? I am trying to find someone that can write a similar EA for me. I have the concept but do not know how to write the code.
16.02.2012 15:17 gator

indeed is profitable but needs optimization

22.10.2011 22:45 barauskasjustin


SymbolEURUSDFXF (Euro vs US Dollar)
Period5 Minutes (M5) 2007.03.30 17:01 - 2011.09.30 00:59 (2007.01.01 - 2011.06.20)
ModelEvery tick (the most precise method based on all available least timeframes)
Parametersseparator1="------trend settings------"; useEMAtrend=true; barsInTrend=1; EMAtrend=144; separator2="------WPR settings------"; iWPRPeriod=46; iWPRRetracement=30; useWPRExit=true; separator3="------position settings------"; lots=0.1; maxTrades=2; stop_loss=50; take_profit=200; useTrailingStop=false; trailing_stop=10; useUnprofitExit=false; maxUnprofitBars=5; magicNumber=13131;
Bars in test335572Ticks modelled34632921Modelling quality99.00%
Mismatched charts errors0
Initial deposit10000.00
Total net profit3924.40Gross profit32367.40Gross loss-28443.00
Profit factor1.14Expected payoff1.64
Absolute drawdown376.60Maximal drawdown1261.60 (8.53%)Relative drawdown8.53% (1261.60)
Total trades2399Short positions (won %)1100 (65.45%)Long positions (won %)1299 (69.44%)
Profit trades (% of total)1622 (67.61%)Loss trades (% of total)777 (32.39%)
Largestprofit trade136.60loss trade-54.80
Averageprofit trade19.96loss trade-36.61
Maximumconsecutive wins (profit in money)30 (287.20)consecutive losses (loss in money)12 (-599.60)
Maximalconsecutive profit (count of wins)455.80 (18)consecutive loss (count of losses)-599.60 (12)
Averageconsecutive wins4consecutive losses2