We suppose that the price will repeat a movement each specific hour of a day each month. For example, the price follows the main trend most of the time at 14 gmt the 4th day of the month. Or it goes mostly in the opposite direction, or there is no particular way (it can goes up and down).
The trades are closed on the next bar.
We define the main trend with a 100 SMA.
We have for example the hour14 :
The first value is for day1, then day2, day3, ... until day31.Code:2,1,2,0,2,2,2,1,0,2,2,1,2,0,0,2,0,2,2,2,1,1,2,1,1,2,2,1,1,0,2
0 = trend following,
1 = reversing,
2 = don't trade.
When we optimize the code, we begin with default settings in the strategy tester, and we put this line for the hour that we want to set first :
We click on start. We get the results that we save. We then open the statement with forex control center (a great tool to go faster and deeper with backtesting). We click on "charts" and "pips by day of the month". We have a histogram. We determine if we should follow the trend or not or to not trade at all, if one of the histogram is twice bigger or not than the other (red compared to green). If Red is higher than green, we put 1, if green is higher than red, we put 0. If the values are similar, we put 2.Code:0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
We have our set for this hour. We continue the optimization. We reset the settings, we put the 0 values in the next hour paratemer, etc...
It should be better to optimize the EA on 3 years and on a more active pair (GBPUSD). The results will be more interesting with a low spread as the body of a bar is generally tight.
EU H1. 2009.
Total net profit : 78699.08%
RDD : 6.97%
Download : Reversing Hours EA (available in the Elite section)






