Data Arrangement : Closing price of N stocks, arranged as T*N matrix (name this matrix as 'data' and save it as MABasketOptData.mat if you don't want to modify the code below).
Example System : MA-Price crossover
Customizable Parameters: Initial Capital, Execution Lag, Starting Optimization Value, Increments, Ending Optimization Value, Transaction Cost
Optimization Objective: Maximize slope of equity curve, calculated via least squares regression (Without intercept term), with respect to time
Results Image:
I've regressed log of equity value w.r.t time unit (as 1,2,3...), so the beta appears as .01 in all cases owing to short formatting. In actual case, it looks more like:
0.012439499782394
0.011914742989712
0.012889507971229 etc
You can see this by using 'format long' and typing BSBeta.