This forum is in read-only mode now. You may discuss your questions on forums of MQL4.community and MQL5.community

Expert Advisor optimization


Back to topics list  | 1 2
avatar
129
Vooch 2005.07.02 15:58 
I would like to use the optimization feature in the backtesting, but I don't know how to do it.

What code do I need in my Expert Advisor to turn that feature ON?

Let's say for example, that I want to test for the best EMA:
double emastuff = iMA(NULL,Period(),xxxxx,0,MODE_EMA,PRICE_CLOSE,0);
where 'xxxxx' is the part I want to optimize
avatar
4464
Slawa 2005.07.02 16:33 
optimization let You change input parameters. set appropriate start step and stop values in the expert properties and turn on optimization button
avatar
129
Vooch 2005.07.02 16:37 
How do I "set appropriate start step and stop values in the expert properties"?

By using an extern variable in my script?

Let's say for example, that I want to test for the best EMA:
double emastuff = iMA(NULL,Period(),xxxxx,0,MODE_EMA,PRICE_CLOSE,0);
where 'xxxxx' is the part I want to optimize
avatar
4464
Slawa 2005.07.02 16:40 
How do I "set appropriate start step and stop values in the expert properties"?

By using an extern variable in my script?

Let's say for example, that I want to test for the best EMA:
double emastuff = iMA(NULL,Period(),xxxxx,0,MODE_EMA,PRICE_CLOSE,0);
where 'xxxxx' is the part I want to optimize

of course. set external int xxxxx=13; (or so on) and set in the properties it's start step and stop
avatar
129
Vooch 2005.07.02 16:44 
OK Great!

I got it working now.

Thanks!

;)
avatar
86
JannikKristensen 2005.07.02 19:48 
why dos some values dont work on the strategy tester for example on the macd sample
avatar
129
Vooch 2005.07.02 20:01 
Jannik,

What does your macd code look like?

- Vooch
avatar
129
Vooch 2005.07.02 20:20 
Slawa,

On the optimizer, I have:

extern int optimize;
start
{
...
TakeProfit = optimize;
...
}

and I set optimize to start=10, step=10, stop=100

it loops through 10 times and it shows 2 results and discards 8.
The 2 that is shows, in the Pass column, it shows 1 and 2, which makes me think 10 and 20 are the best TakeProfit values to use.

Yet, when I set TakeProfit to 50 manually, I get a better net profit with that than when I have it set to 10 manually.


avatar
129
Vooch 2005.07.02 21:19 
ahhhh...

If I rest my mouse on the profit line of the "Optimization Graph", it'll tell me what the value of optimize is.

:)
avatar
129
Vooch 2005.07.02 22:15 
I can also rest my mouse on the grey dot of the "Optimization Results" tab to get my best optimize value.

avatar
86
JannikKristensen 2005.07.03 01:57 
to Vooch

What does your macd code look like?

- Vooch [/quote]


i like to use 200 or greater in movingaveragetrend period example 200/55/34 on 5 min charts
Back to topics list   | 1 2  
Download MetaTrader 5 (450 Kb, web installer) — a new terminal for financial markets