AMQParticipant
Average
Hello everyone, Regarding the multitime frame, I have an automatic strategy that operates in TF 2 min, with filters in daily and weekly TF. Currently carrying out a Backtest takes a long time and we believe that it is due to the daily and weekly checks in TF. Help is requested to see some idea that allows redefining the code and allowing backtests to be carried out in less time. Thank you very much Regards Alfonso
There can be many reasons on why a backtest takes a long time to be made.
Mutliple timeframes conditions is one of them, but it all depends on the way you have coded the conditions, if it carries loops, arrays, or many indicators declarations, .. and so on.
How many bars? Are you making optimizations or single backtest only?
AMQParticipant
Average
Thanks a lot, Nicolas.
You can see the strategy attached. There is a call to an external indicator, that I am not able to attach aswell, so I will start to work by writting it inside the code.
Thanks for the ideas you can share to improve de code in order to get less time per backtest.
Alfonso
Well, I see that there are a lot of TIMEFRAME declarations and sometimes for the same timeframe. Why not calculate everything for the same timeframe just below the same TIMEFRAME instruction?
When you declare variables, and that variables will not get any other values afterwards, use ONCE.
Try to avoid calculation when not needed (for example, there is a 25 lines of position size calculation on each bar, even if you are at market already)..
AMQParticipant
Average
Ok, perfect: I tried ONCE and comment the lines that I dont use for the money management. After all, it seems to get less time to make each backtest. Thanks a lot
Regarding de timeframe declarations, I have some of them like “Timeframe(1week)” and others like “Timeframe(1week, updateonclose)” so I cannot put all together.
Is it possible to know what time should be the best one to backtest faster??
Thanks again.