Lesson 13 - Your First Expert Advisor (Part 1)

 
Files:
lesson13.pdf  209 kb
 

Ea

Hi Coders Guru,

I'm looking forward to learning all the parts of this EA. I noticed in the code:

static int last_direction = 0;

static int current_dirction = 0;

Note the missing "e" in the 2nd line. I don't know if this will matter, but I thought I'd better bring it to your attention.

This EA seems to be a EMA 8,13 crossover. It makes a loss on my eurusd H4 chart, so I would like to be able to optimise the 8 and 13. I guess by now we should be able to make them ext double variables and optimise them, so I will try to do that.

Also, how do we ask the EA to draw the 2 EMA's on the chart? I don't know why EA's don't automatically draw the indicators they use, because we will always want to see them.

Thanks again for these great lessons.

 
 

Bars in Test

There were 1492 bars in my losing test. How many did you have in your profitable test?

 
barry:
There were 1492 bars in my losing test. How many did you have in your profitable test?

I was have 832 bars, Please find the detailed report attached.

Files:
report.zip  11 kb
 

Results

Coders Guru,

Thanks for the report. I know the point of this is to learn to code, but I wanted to check that we get the same results, so I know I'm doing it right. In fact, we don't get the same results for the same script, but it's pretty close, and I'm guessing the difference is due to different data. I get my data from InterbankFX.

Thanks again, love the course,

Barry

 

ea

codersguru:
I was have 832 bars, Please find the detailed report attached.

Hallo guru ,I it seems like the result of the ea here is go south ,what happen? is is becouse of differnce of the broker or I dont know how to apply it ,your look great base on what is these ea guru ? Regards audio

 
Audio:
Hallo guru ,I it seems like the result of the ea here is go south ,what happen? is is becouse of differnce of the broker or I dont know how to apply it ,your look great base on what is these ea guru ? Regards audio

Audio,

I think the differnce of the data feed (as Barry said) is the reason of the differnce of results.

For example different brokers and the different number of bars.

Anyway , This EA is for educational purpose and we can not study its behavior as a real EA.

 
codersguru:
Audio,

I think the differnce of the data feed (as Barry said) is the reason of the differnce of results.

For example different brokers and the different number of bars.

Anyway , This EA is for educational purpose and we can not study its behavior as a real EA.

ok guru but if we reverse the contain of it may be good?

 

What do you mean?

Audio:
ok guru but if we reverse the contain of it may be good?

Audio,

What do you mean? Do you mean increasing the number of history bars? Or changing the broker?

 

Different Data

Yes, I've also seen the same problem with EA testing using strategy tester...for the same set-up, each run provides different outcome (sometimes no trades at all!).

This problem increases as you try to test your strategy on older data and also on exotic crosses (non-major pairs). I have posted a question in MetaQuotes forum, but so far no reply.

My current solution is to run the test multiple times (takes more time) and then eye-ball the average statistics to get an idea about how effective your EA is.

Reason: