Mean Reversion EA

 

I have been trying to create a mean reversion ea using a zscore indicator.

what I have been attempting to achieve is an EA that has MTF zscore indicators all working on the one charts i.e. if I place the ea on a 1hr chart I will have the 5,15,30,60,240,1440min lines all moving and generating signals. At the moment only one is moving and that's the chosen TF. My question is can this be done.

I have attached my efforts so far.

This is just and idea it might be rubbish but it is still and idea

Cheers Beno

Files:
z1.mq4  13 kb
zscore6.mq4  3 kb
zscore.gif  72 kb
 

EA and indicator fixed

Hi Beno,

I hope this help you. I've modified your indicator zscore6 so that it show the zscore on your graph (6 lines) and I've also added a label so that you know which value is which.

Then I've created a new indicator called zscore1_timeframe so that you can use it in your EA. The EA will set the different timeframes. Also note that I deleted the barstocount in this indicator. There is still something wrong in the EA because it get stuck after a few trades and didn't open or close trades anymore. If I have time i'll try to find the problem. This should help you in the mean time.

Please let me know if you have fixed the EA. Their is a problem somewhere else (not the custom function)

Good luck.

Derik

Ps. I've also saw this thread:

https://www.mql5.com/en/forum/176527

Files:
 

Hi,

I've fixed the indicators. The previous ones divide by zero because you use a time period of 60 and I used the bars-20 as counter.

for(int i = 0 ;i <= limit-60 ;i++)

The EA problem is due to the pending order placement. The EA place a pending order on the USDJPY (test period 2000-2007). This pending order must be deleted after a certain period because the price never moved lower than the trade early 20000104. The EA doesn't remove these pending orders and no more trades is opened after that.

Good luck.

Files:
 

EA fixed. I've removed the remorder and replaced it with TimeCurrent()-OrderOpenTime()>6*3600. This will remove any pending order after 6 hours or (6x3600) seconds. Here is the latest EA and indicators.

 

Thanks derikb

You must have the fastest fingers in the west. I am still trying to figure out the first part of the problem.

cheers Beno

 

I've been referenced for a system I can't begin to understand. What is the zscore indicator doing?

 

The zscore measures the number of standard deviations from average closing price over a set period. It can be use like an over sold and over brought indicator it also can help pick trend change very early. well that's what I have read so far

 

so its only measuring the standard deviation of the price on the given chart? what are the levels to look for on a reversal level? COuld you post an example chart for me to see this in action? thanks

Reason: