twenty=now_time.hour<21 && now_time.hour>20;
Hour is an integer — if it is greater than 20 it can never be less than 21.
William Roeder:
Hour is an integer — if it is greater than 20 it can never be less than 21.
Thanks, you're right.
Anyway I've changed the value as below but the situation doesn't change.
TimeCurrent(now_time); we=now_time.day_of_week==5 && now_time.hour>=19; twenty=now_time.hour<=21.5 && now_time.hour>=19.8;
Moreover it doesn't seem to stop and close positions during the weekend and I'don't understand why....
Thanks in advance
Riccardo_1983: Moreover it doesn't seem to stop and close positions during the weekend and I'don't understand why....
Because the market is closed during the weekend.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Good afternoon,
I'm writing and EA in MQL5 with Bollinger Bands based on example I've found on this site.
I'm trying to say to the EA to stop trading Friday at 21:00 (server time) and during the week to avoid to trade from 20:00 to 21:00.
Unfortunately during the backtesting it doesn't work.
Below the entire code of the EA:
Thanks