is there anyway i can back test an EA I have written

 
sorry for the newbie question

I have written a couple of basic EA's and am looking at refining them, but each time I make a change I have to just test it using real-time charts to see if it does what I want it to and to see if it works to make money (never does :( )

Is there a way I can backtest an EA to see what it would have done with all the historic data stored in the charts?
 
Load up MetaTrader
Press the Strategy Tester button on the toolbar
Make your selection in the boxes typically you'd select 'Use date' & a From & To date (dont select Optimization for a simle back test)
Press start when all is set
When the green progress bar finishes, review the tabs for results, graph & report.

You are looking for a nice smooth or slighly ripply rise in the graph - big jaggies are bad news.
Obviously you want a net profit in the report but watch for Profit Factor & Drawdown figures.
Many highly profitable systems can easily turn on you if the drawdowns are too big or frequent in the next period :eek:

Test over at least 12 months, 24 is better
If the report says the 'modelling quality is n/a or below 90%, go Tools menu/History Center & download some new data for the time period & pair of interest
Good luck :)

PS If the EA's are that basic, post them on here & see if we can pep them up?
 
cheers that works great.

My basic idea was just to lump three or four indicators together and then say buy if there was a majority saying buy. At the moment I have it working for parabolic SAR, have tested it on various things and it just seems random whether I make money or not, loads of jaggies all over the place.

Is there a way you can look at one of the in built indicators and tell how to access its variables? In the parabolic SAR one I have used, there was some commented out bits at the bottom which had a function written to access the variable.
 

If you go to MQL Documentation on this site, the Technical Indicators section will show you what you can get from each one,
e.g. iMA can give you Simple, Exponential, etc.
All Indicators have the ability to look at their value for the current period (0) and back n periods.

Some indicators just do not work well on some Forex pairs, or they may be OK on the long but not the short periods, etc.
PSAR is OK for stop loss calculation but a bit laggy for trade entry (IMHO of course)

Start with one indicator, optimise for it, see what areas need improving...

I would suggest iMACD on EURUSD H1, perhaps with checking that the 5 day SMA is above/below the 20 day SMA for buy/sell confirmation...

You could do worse than running the MT4 MACD Sample through the optimiser for EURUSD H1 & just using the results HINT HINT :)

There are many programming examples here:

https://www.mql5.com/en/code

and

http://www.forexmt4.com/_MT4_Experts/

but take nothing for granted - the good ones will be obfuscated, at least by incorrect paramaters, the worst ones will blow your account in a 2 days :(

So use them mainly as ideas of programming approach or for techniques to implement trading ideas

Semper Fi

Reason: