I have done a simple EA to test the best EMA methods to buy/sell on Forex. Its for studying indicators...
So I have 3 conditions to buy/sell based on:
- Closed Price crosses EMA;
- Short EMA Crosses Long EMA;
- Closed Price crosses EMA if on trend;
The problem is that I have made 3 If's to make optimization "select" the best methods and periods but i have made one change:
- On the 1st test:
extern bool PriceCrossEMA = false, EMACrossEMA = false, PriceCrossEMAwTrend = false;
- On 2nd test I have changed Ifs
extern int EMA_Method = 1;
if(EMA_Method == 1)
if(EMA_Method == 2)
if(EMA_Method == 3)
On Optimization I have selected the same start, step and end values. Results are different!!! Test Period 2006 - 2010 on EURUSD.
On the log it shows:
2016.05.21 00:04:34.571 EA_EMAs_Study_20-05-2016: optimization finished in 0:00:01, 723 cache records were used, 723 cache records rejected
2016.05.21 00:04:33.124 EA_EMAs_Study_20-05-2016: optimization started
2016.05.21 00:04:33.124 TestGenerator: actual tick file "C:\Users\MetaTrader - Install\tester\history\EURUSD1440_2.fxt" found
2016.05.21 00:04:33.119 Tester: template 'C:\Users\MetaTrader - Install\templates\tester.tpl' applied
2016.05.21 00:03:50.912 Expert EA_EMAs_Study_20-05-2016 EURUSD,Daily: loaded successfully
2016.05.21 00:03:50.888 Expert EA_EMAs_Study_20-05-2016 EURUSD,Daily: removed
2016.05.20 23:52:57.607 There were 485 passes done during optimization, 171 results have been discarded as insignificant
2016.05.20 23:52:57.599 EA_EMAs_Study_20-05-2016: optimization finished in 0:00:01, 1247 cache records were used, 1243 cache records rejected
2016.05.20 23:52:55.926 EA_EMAs_Study_20-05-2016: optimization started
2016.05.20 23:52:55.925 TestGenerator: actual tick file "C:\Users\MetaTrader - Install\tester\history\EURUSD1440_2.fxt" found
2016.05.20 23:52:55.925 Tester: cache file "C:\Users\MetaTrader - Install\tester\caches\EA_EMAs_Study_20-05-2016.EURUSD1440.2" found and can be used for further optimization
Am I doing this correctly? Whats the reason for different results? The source goes in attachment for testing.
Anyone can help this question?
To today I have the same problem making tests to the EA and I have different results for the same code!