Issue with backtesting a multi time-frame EA
-
Hello!
https://fxdreema.com/shared/LHfpMaIbb
In this system. I am trying to backtest a multi TF system. I have created a constant that acts as an on and off switch to disable other currencies/TF while back testing. In this example that I have provided, if you look in each condition, you'll notice the constant for the candle period. "1 = on". "-1 = off". Having "-1" helps because when I would use a "0" as the candle ID I knew MT5 would not make any trades on that currency, but for some reason it did. So using a "-1" shuts that portion of the system down or prevents that specific currency/TF from trading in backtest.
So now that I am able to backtest without random trades from other currencies, I am now running into TF issues. If I optimize M15 EURUSD to get the optimal parameters and write it down. I would then use "-1" to disable M15 EURUSD and now type "1" to enable H1 CADCHF and run an optimization and write down those optimal parameters. I now would type "1" to enable BOTH currencies and just run a backtest using optimal parameters and would ONLY get results from the M15 EURUSD.
I tried to change the TF in the "more settings" in the condition block but to no avail. My actual system has 3 pairs on 3 different timeframes but only makes trades on the M15 TF. When I disable all other currency/TF and backtest individually, I have no issues. It's when I have to enable all currencies/TF and run backtest is where my problem is.
Please advise!
EDIT: Changed price modeling from "open prices only" to "1-minute OHLC" and seems to now trade all currencies/TF like I wanted. O_o
-
@gooseman I would suggest to create a Constant for the TF instead and then use it on blocks 1 and 8. You can select 1 for 1 minute, 2 for 5 minutes, 3 for 15 minutes and so on on the 'on tick' tab. That should do the job.
-
@l-andorrà Coñoooooooo! Gracias hermano! hahahaha
It worked! Using a constant for the TF worked out great! One thing to add, especially for those who come across this. As l-andorrà mentioned, using a constant for the TF but you have to change the constant type to:
ENUM_TIMEFRAMES
Then you will get a fancy drop-down menu where you can choose your time frame in the inputs tab. Thanks again, learning this has GREATLY reduced my walk forward optimization process.
-
@gooseman said in Issue with backtesting a multi time-frame EA:
@l-andorrà Coñoooooooo! Gracias hermano! hahahaha
It worked! Using a constant for the TF worked out great! One thing to add, especially for those who come across this. As l-andorrà mentioned, using a constant for the TF but you have to change the constant type to:
ENUM_TIMEFRAMES
Then you will get a fancy drop-down menu where you can choose your time frame in the inputs tab. Thanks again, learning this has GREATLY reduced my walk forward optimization process.
jajajaja
ayyeee Conoooooooooo!
Que rollo?!?!?
-
@gooseman Ja, ja, LOL. Me alegro de que haya funcionado.
