Automate IS and OOS Backtesting

I would like to automate the following backtesting routine:

-> Run an optimization on a specific time period, the in sample data
-> Pick the the five strategies with the highest Net Profit from that optimization
-> Run those five strategies on a different time period, the out of sample data

Can this process be automated with AmiBroker and the Batch Window or somehow else?

Thank you

You find best strategy using built-in optimizer:

strategy = Param("Strategy", 1, 1, 5, 1 );

switch( strategy )
{
  case 1:
   // strategy 1
    Buy =
    Sell =
   break;

  case 2:
   // strategy 2
    Buy =
    Sell =
   break;

  case 3:
   // strategy 3
    Buy =
    Sell =
   break;


  case 4:
   // strategy 4
    Buy =
    Sell =
   break;

  case 5:
   // strategy 5
    Buy =
    Sell =
   break;
}

And you can run built-in walk forward to switch between best strategies in OOS periods.
If you wanted to sum 5 "best" strategies, you could run just 5 WF sequences successively eliminating those top in subsequent runs.

1 Like

Thank you for your help. I think I described what I wanted to do not good enough.

With your process I have to put the strategy code into a code. That is not what I want.

I have allready a strategy with a lot of functions and parameters to optimize. The result of the optimization (non-exhaustive opt.) are hundrets of different variations with certain parameters.
I would like to pick the top five or top ten. (Net Profit).
And then run the stratety with the different parameters on the out of sample data.

I am doing this proecess right now, manually. But I want to automate it somehow. I thought on the batch window.

Thank you very much

This thread might be useful for you.

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.