Global Optimization for unique fitness function

1 view (last 30 days)
Beaver
Beaver on 22 Dec 2015
Commented: Beaver on 19 Feb 2016
Hello,
I've searched for similar questions but found nothing.
I'm trying to maximize the sharpe ratio of a strategy. I have parameters for: entry signal, exit signal, signal line parameter (the rsi fcn with discrete inputs), stop-loss, may days held (also discrete). My function takes a n x 1 array of closing prices uses the parameters and calculates the sharpe ratio for returns (derived from the input array) of a strategy based on the rsi signal line for entry and exit.
I cannot find a routine that will perform this optimization. Most routines are f(x) = .... functions that perform on x.
Any suggestions?
  3 Comments
Beaver
Beaver on 12 Feb 2016
Hello Jgg,
Thanks for your comment, it is getting me going. I implemented your suggestions and I'm close to what I'm trying to do. A question I came upon involves parameter specifications. my parameter array has 5 elements. Some are discrete non negative while others are decimal. Do you happen to know how to constrain and specify constraints?
Thanks.
func = @(para_inputs)(calcSharpe(ts,para_inputs))
p_0 = [5,2,20,StopLoss,MaxDays];
[out,feval] = patternsearch(func,p_0);
StopLoss is bound from 0.0 to 1.0
Beaver
Beaver on 19 Feb 2016
I ended up implementing the following:
para_inputs=[5,2,20,.03,5];
func = @(para_inputs)calcSharpe(ts,para_inputs);
p_0 = para_inputs;
[out,feval] = patternsearch(func,p_0,[],[],[],[],[3,0,1,.01,1],[30,50,50,.2,20]);

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!