Experts: 10pipsOnceADayOppositeLastNHourTrend

 

10pipsOnceADayOppositeLastNHourTrend:

10 pips per day opposite to the "yesterday's trend".

Author: Vladimir Karputov

 

If there were some parameters to adjust, it might be an idea!
 

Hello, Vladimir!

I have experimented a little with this Expert Advisor and found one strange peculiarity. To determine the trend direction I try to set HOURSTOCHECKTREND value equal to 1, because I do not want to take a long period (for example, 30 hours), i.e. to determine the trend I need only one previous bar before the hour on which the position should be opened. For example, a position should be opened every trading day at 7 a.m. If the closing price of a 6-hour bar is less than the opening price of the same bar, the trend is considered to be downward and the position is opened on BUY, and if the closing price of a 6-hour bar is more than the opening price of the same bar, the trend is considered to be upward and the position is opened on SELL. If the opening and closing prices of a 6-hour bar are equal, the position is not opened at 7 o'clock and the trading day is skipped.

I set HOURSTOCHECKTREND to 1, but during testing all positions were opened only on SELL regardless of what the previous bar was. Due to the fact that I am not strong in programming, please help me to refine the code of the Expert Advisor to make it work as described above in the text.

I attach a screenshot of the EA with HOURSTOCHECKTREND equal to 1.

Regards, Vladimir.



 

Added comments to the screenshot.