Backtest multiple moving average combinations
The short one could be 3, 5, 8, 10, 14.
The long one could be 26, 30, 35, 40.
enum ShortPeriod { SP_3=3, SP_5=5, SP_8=8, SP_10=10, SP_14=14 } enum LongPeriod { LP_26=26, LP_30=30, LP_35=25, LP_40=40 } input ShortPeriod fast=SP_3; input LongPeriod slow=LP_26;
Of course it possible:You can only do this for a range of ints, e.g. slow = 25 to 40 step 5. The OP has specific values that is not constant multiples.
You can do this in oninit() function.
Run the moving average cross over all candles and simply count the crossovers.
Change a parameter and run it again, as many times as desired and then compare results.
Ultra fast when compared to the super slow backtester.
You don't need these timely backtests and if you run it in the oninit() it will be adaptive and always up to date.
Greetings,
I wonder if it is possible to write a script which will backtest an EA multiple times, but each time using a different set of moving averages in order to determine the most profitable combination?
An example would be to have 2 MAs, a short one and a long one.
The short one could be 3, 5, 8, 10, 14.
The long one could be 26, 30, 35, 40.
The script would change the value of the EA's moving averages after each test and print out the results.
I do possess the programming skills to write such a script, but I wonder whether it is possible with current API and libraries.
Thank you!