How to Trade in a Specified Timeframe
12 replies
toddone46
9 years ago #113511
I have tried all the “Time” settings I can think of, read the manual, searched the forum, and looked at other EAs on times but I can’t get my developed EA to trade in a specific timeframe. Can someone tell me what exact parameters I need to enter to trade, for example, only in the timeframe of 06:00 – 12:00? Everything I’ve tried doesn’t work.
Thanks,
Todd
krikri
9 years ago #129488
Hi Todd,
add in your trading rules.
Hour >=6 and Hour <12
I use this conditions in my EA and it’s work !!
best regards.
Kris
toddone46
9 years ago #129489
Hi Todd,
add in your trading rules.
Hour >=6 and Hour <12
I use this conditions in my EA and it’s work !!
best regards.
Kris
Thanks Krikri, I tried that one already and it doesn’t work. It might have something to do with the fact I’m using custom indicators. I notice sometimes the EA won’t adhere to parameters I set around these indicators sometimes. Bummer.
toddone46
9 years ago #129512
Just to update, using this method does work when making an EA from scratch without the custom indicator I was using originally. For some reason when I use that custom indicator it does not recognize the timeframe constraint I place on it.
Mark Fric
9 years ago #129542
it shouldn’t depend on custom indicators use – if you have condition that rule is not active in some range then it will not trade.
Isn’t the problem that you use OR in your rules and don’t have proper brackets?
We would be wiser if you’ll post your strategy here.
Mark
StrategyQuant architect
krikri
9 years ago #129559
Hi Mark,
how use function “TIME”
if TIME=9:15 OR TIME=9.15 or other ?
what is the difference with TimeCurent ? If I want EA start at 9:15 am stop à 17:30 pm what is the best soultion ?
best regards
Kris
toddone46
9 years ago #129566
it shouldn’t depend on custom indicators use – if you have condition that rule is not active in some range then it will not trade.
Isn’t the problem that you use OR in your rules and don’t have proper brackets?
We would be wiser if you’ll post your strategy here.
When I went into MT4 to test the strategy with a timeframe set to trade so I could post it here, I cleared the history folder and downloaded new history data. When I did that, the EA works perfectly now and trades within the timeframe assigned. So it was a data issue with MT4 it looks like.
krikri
9 years ago #129573
Hi Mark,
how use function “TIME”
if TIME=9:15 OR TIME=9.15 or other ?
what is the difference with TimeCurent ? If I want EA start at 9:15 am stop à 17:30 pm what is the best soultion ?
best regards
Kris
tomas262
9 years ago #130178
Hi Krikri,
you can use following rules to get it working as you need – enter the market within specific time range. See the screenshot below. TimeCurrent is time of the last trading activity while Time returns “timestamps” of a bar x bars ago
krikri
9 years ago #130199
tomas262
9 years ago #130202
If you want to use variable instead of fixed values for H:M:S you have to create a new variable under Strategy tab – Strategy Parameter using Add new button. Call it “hour” for example and set it to “int” and give it value 9.
Then within the rule creation dialog instead of typing “9”, select your new variable “hour”
You do it the same for minutes and seconds.
I have attached example for you
krikri
9 years ago #130203
daveM
8 years ago #133709
I used this approach and it seems to be working well.
thanks
Hi Krikri,
you can use following rules to get it working as you need – enter the market within specific time range. See the screenshot below. TimeCurrent is time of the last trading activity while Time returns “timestamps” of a bar x bars ago
Viewing 12 replies - 1 through 12 (of 12 total)