Hi,

Here is a template strategy ETF rotation strategy, it attemps to optimize the variance of a combination of ETF using a contrained Optimizer (Accord Cobyla method).

I'm sharing for feedback, It is not complete I've left out ETF universe selection and money management but it still produces interesting results (beware of QC data issues for TMF 8/25/2016 if you backtest a long period).

I'm looking for comments/feedback on the C# code as I've not done any C# since .NET2.0 and it is not as straight forward to deal with matrices and vector as it is in scipy/python.

There are 2 files in addition to the Main.cs: 

- ComputationExtensions where I've added some matrices/vector operations like double[].StdDev(), reusable for other strategies...
- Optimizer where I parked all my Accord library call to avoid extension clashes, and where I have the variance optimisation which uses the Cobyla optimisation which decides which "optimal" weights to apply to the selected ETFs

As for improving the base strategy, you can broaden the universe selection and change it dynamicall based on ETFs correlations, add some VIX/trend controls to limit DD, You can also play with the rebalancing frequency...

It should/could also work for non leveraged ETF or combination of stocks and ETFs ...

Author