Trades only 8 am – 3 pm
24 replies
Uwe6000
6 years ago #232923
Hello, I would like to go long only at certain times eg 8am – 3 pm. Optional 5-9 clock.
It does not work in the backtest. The orders are opened only in the time from 8 am to about 10 am.
What could it be? Here my example:
Best regards
tomas262
6 years ago #232947
Uwe6000
6 years ago #232967
Hello, once again…
tomas262
6 years ago #233025
Uwe6000
6 years ago #233056
Hello, great !!! thank you
Uwe6000
6 years ago #233057
and if i like trade 8 – 15 and 16.30 – 22 ?
i try this without minutes:
And ((Hour[0] >= 8)
And ((Hour[0] <= 15)
And ((Hour[0] >= 16)
And (Hour[0] <= 22)
its not working, no trade will be open.
Close all positions at 21.55 sounds good. How can i do this?
regards
Conmariin
6 years ago #233072
I think the condition will never happen and parenthesis is wrong.
Try it with
((Hour[0] >= 8) AND (Hour[0] <= 15))
OR ((Hour[0] >= 16) AND (Hour[0] <= 22))
Conmariin 🙂
Automatisches Handeln mit Expert Advisor
https://www.rabenesche.de
tomas262
6 years ago #233097
Hello,
yes Conmariin is correct on this. You need to use the OR operator so market is either in range from 8 to 15 OR from 16 to 22
Uwe6000
6 years ago #233171
Hello,
that sounds good, but where can I find the OR operator? Whenever I create a rule, it is always AND operator at the beginning of each line.
tomas262
6 years ago #233177
Uwe6000
6 years ago #233191
Hello, oh thanks, I had not discovered that
Uwe6000
6 years ago #233197
Hello, something is wrong…
tomas262
6 years ago #233201
Hello,
you need to use parentheses as Conmariin showed higher.
((Hour[0] >= 8 AND Hour[0] <= 15)
OR (Hour[0] >= 16 AND Hour[0] <= 22))
So you enclose “ANDs” together. If you need me to edit the project for you please send to [email protected] or upload ZIP file
Uwe6000
6 years ago #233205
hello tomas, I have sent you a mail with file and explanation on your e-mail. Best regards Uwe
Uwe6000
6 years ago #233285
hello, can I change that in the wizard or is that only possible in the Meta Editor?
tomas262
6 years ago #233295
Hello, surely can be done in EA Wizard, I have sent you an email back