Adaptive portfolio strategies that can optimize on-the-fly.

Hi all,

I'm a systematic trader (stocks, options,crypto) trying out Amibroker after hearing that it is good for Portfolio algos.

I'd like to bring some of my strategies here, and share them / collaborate on them with the community.

That said, I do have some quick questions on what is possible in AmiBroker:

  1. Is it possible to add logic for a strategy to periodically optimize itself as it backtests? For example, if I am backtesting a day trading strategy over the last 5 years, and I'd like to reoptimize the parameters evey 6 months to adapt to the current market regime.

  2. A follow-up to the above question is regarding a more complex scenario:

One of my systems is a trend following system that trades a basket of 20 symbols, opening positions based on a breakout signal.

For each of the symbols, the parameters for the breakout signal will differ. For example, the breakout signal for $ABC might involve the 20 day high, and for $XYZ I might the 10 day high. However, these ideal parameters are not known before hand.

Is it possible to script logic in Amibroker that will allow the system to run an optimization, on-the-fly, for each symbol, to determine the optimal parameter set, and apply them?

  1. Assuming some or all of this is possible in AmiBroker, please share some learning resources that can help get me up to speed. These might be documentation, shared code, YouTube videos, forum posts, etc.

Thanks in advance!

  1. That is called Walk forward optimization

  2. Don't ask me how, but it is possible. You will need to use things like a CBT (custom backtest) interface.

Those are the things you need to look for.

Ah, thanks again for responding here @Henri! :smiley:

Yes, it is WFO that I am looking to apply, BUT... i'm not doing it to evaluate the strategy. I actually want it to be part of the strategy, so the algo will optimize itself as it runs, every N months.

I will explore custom backtests and see if those will help. Thanks.

WFO is part of the strategy.

If you do WFO you would, for example, do the following:

Look at the first 6 months of data, optimize, use the optimized results for the next 3 months. 3 months later, you look at the last 6 months, optimize, and use the new optimized results. You keep doing that.

So WFO is part of your strategy, it will use the last results from the optimisation.

There are several settings, I have never used it before so I can unfortunatly not explain you everything exactly, but there are settings for how often you want to look back and to what period etc. etc.

Hopefully someone that has actualy used it will respond and make it more clear but as far as I understand, it definatly is part of the strategy.

1 Like

Brilliant. THIS is why i signed up for AmiBroker :slight_smile:
I will keep investigating, but hopefully someone can share how they did this.

Auto-optimization framework, see:

1 Like

Seems I missed this notification. Thanks Tomasz!
Will give It a read.

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