Hi,
When optimizing a strategy or portfolio, ideally I would like to optimize based on the Sharpe ratio. Also, I would like to be able to view the Sharpe ratio on the optimisation reports (standard strategy optimization and portfolio optimization).
There is a feature in the Project Management app that says that the Sharpe Ratio has been added to the optimization report and the version with it in released:
https://www.multicharts.com/pm/viewissu ... _no=MC-636
However when I view the Optimization reports it is still not present (please see screenshot attached).
Am I looking in the right place or am I misunderstanding something?
Also, I have added a feature request to allow for optimizing by Sharpe ratio. Please up-vote it!
https://www.multicharts.com/pm/viewissu ... no=MC-1256
Optimize on Sharpe Ratio
Optimize on Sharpe Ratio
- Attachments
-
- Screen Shot 2013-02-28 at 18.08.21.png
- (143.12 KiB) Downloaded 2818 times
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: Optimize on Sharpe Ratio
Isn't this already possible with the SetCustomFitnessValue? I haven't coded it myself, but the parameters for the Sharpe ratio can be calculated in PowerLanguage, and the resulting Sharpe ratio passed to the SetCustomFitnessValue() function.When optimizing a strategy or portfolio, ideally I would like to optimize based on the Sharpe ratio. Also, I would like to be able to view the Sharpe ratio on the optimisation reports (standard strategy optimization and portfolio optimization).
Dru has made an optimization by linear equity curve here, which may serve as a helpful example.
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2958 times
Re: Optimize on Sharpe Ratio
It has been already coded by our team. There is a prebuilt signal !optimize by sharp ratio! or optimize_by_sharp_ratio (in MC .Net) that utilizes SetCustomFitnessValue and allows you to optimize your strategy based on Sharpe Ratio.Isn't this already possible with the SetCustomFitnessValue? I haven't coded it myselWhen optimizing a strategy or portfolio, ideally I would like to optimize based on the Sharpe ratio. Also, I would like to be able to view the Sharpe ratio on the optimisation reports (standard strategy optimization and portfolio optimization).
Add this signal alongside with your trading strategy. We recommend to have it the last in the list as signal calculation priority can be important. Specify Period input (0=monthly, 1=daily):
For exhaustive optimization go to Optimization Criteria tab->Enable "Use limitation"->Standard criteria->Custom Fitness Value.
For genetic optimization go to Algorithm-Specific propeties tab->Standard criteria->Custom Fitness Value.
Click Ok to start the optimization.
- Attachments
-
- optimize_sharpe_1.png
- (9.87 KiB) Downloaded 3466 times
-
- optimize_sharpe_2.png
- (17.7 KiB) Downloaded 3425 times
-
- optimize_sharpe_4.png
- (9.2 KiB) Downloaded 3444 times
-
- optimize_sharpe_3.png
- (7.84 KiB) Downloaded 3459 times
Re: Optimize on Sharpe Ratio
Thanks for the responses guys.
Thanks for clarifying how to do this Henry.
I have to say that it would not have been at all obvious how to do this had you not shown me however!
My preference would still be to just be able to select Sharpe Ratio from the list of things to optimize by and I think that would be more obvious to the user. Still, its good I can get the optimization results I'm after without writing my own custom fitness value.
Ed
Thanks for clarifying how to do this Henry.
I have to say that it would not have been at all obvious how to do this had you not shown me however!
My preference would still be to just be able to select Sharpe Ratio from the list of things to optimize by and I think that would be more obvious to the user. Still, its good I can get the optimization results I'm after without writing my own custom fitness value.
Ed
Re: Optimize on Sharpe Ratio
p.s. At the risk of sounding extremely pedantic, Sharpe is spelled with an "e" at the end. The ratio is named after Mr. Sharpe, so should be capitalised too. You may want to mention it to the devs as it seems slightly unprofessional having the signal mis-named like that in what is otherwise a very professional piece of software
Re: Optimize on Sharpe Ratio
I have tried using the optimize_by_sharp_ratio in MC.NET exactly as described but it does not appear to work. I just get a Custom Fitness Values of 0 when using both Daily and Monthly as the inputs to the signal.
I am working with minute bars over a 3 month range.
As you can see form the screenshots; I've added the signal, run the optimization, with results showing Sharpe of 0 and then looking at the Strategy Performance Report there is a Sharpe of (0.23).
Can someone please confirm that this works as expected in MC.NET 8.5 ?
Thanks,
Ed
I am working with minute bars over a 3 month range.
As you can see form the screenshots; I've added the signal, run the optimization, with results showing Sharpe of 0 and then looking at the Strategy Performance Report there is a Sharpe of (0.23).
Can someone please confirm that this works as expected in MC.NET 8.5 ?
Thanks,
Ed
- Attachments
-
- Screen Shot 2013-03-26 at 15.22.54.png
- (10.1 KiB) Downloaded 2756 times
-
- Screen Shot 2013-03-26 at 15.19.09.png
- (51.76 KiB) Downloaded 2733 times
-
- Screen Shot 2013-03-26 at 15.20.28.png
- (29.33 KiB) Downloaded 2713 times
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2958 times
Re: Optimize on Sharpe Ratio
Hello Ed,
Optimize_by_sharp_ratio works as expected in MC.NET 8.5.
Are you able to replicate this behavior with prebuilt signals like Bollinger Bands or Channel Breakout?
Optimize_by_sharp_ratio works as expected in MC.NET 8.5.
Are you able to replicate this behavior with prebuilt signals like Bollinger Bands or Channel Breakout?
Re: Optimize on Sharpe Ratio
Hi,
Using exactly the same data, when I apply the prebuilt Bollinger Band signal, the optimize_by_sharp_ratio works, but only for "Monthly" input. When I change input to "Daily", the Sharpe Ratio becomes -1.0.
When I add my signal however, inputs of both Daily and Monthly give a Sharpe Ratio of 0.
(See attached screen shots).
My signal gives rise to about 900 trades and a SR of -1.25 in the Strategy Performance Report
The prebuilt BB signal gives rise to 9000 trades.
Is there something that I need to implement in my signal or a certain trade number I need to reach for the optimize_by_sharp_ratio Custom Fitness Value to work properly?
Thanks,
Ed
Using exactly the same data, when I apply the prebuilt Bollinger Band signal, the optimize_by_sharp_ratio works, but only for "Monthly" input. When I change input to "Daily", the Sharpe Ratio becomes -1.0.
When I add my signal however, inputs of both Daily and Monthly give a Sharpe Ratio of 0.
(See attached screen shots).
My signal gives rise to about 900 trades and a SR of -1.25 in the Strategy Performance Report
The prebuilt BB signal gives rise to 9000 trades.
Is there something that I need to implement in my signal or a certain trade number I need to reach for the optimize_by_sharp_ratio Custom Fitness Value to work properly?
Thanks,
Ed
- Attachments
-
- Screen Shot 2013-03-29 at 14.20.44.png
- (32.94 KiB) Downloaded 2725 times
-
- Screen Shot 2013-03-29 at 14.58.34.png
- (32.75 KiB) Downloaded 2730 times
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2958 times
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2958 times
Re: Optimize on Sharpe Ratio
This issue has been confirmed. It will be fixed in the next version of MultiCharts .Net.Hi,
Using exactly the same data, when I apply the prebuilt Bollinger Band signal, the optimize_by_sharp_ratio works, but only for "Monthly" input. When I change input to "Daily", the Sharpe Ratio becomes -1.0.
When I add my signal however, inputs of both Daily and Monthly give a Sharpe Ratio of 0.
(See attached screen shots).
My signal gives rise to about 900 trades and a SR of -1.25 in the Strategy Performance Report
The prebuilt BB signal gives rise to 9000 trades.
Is there something that I need to implement in my signal or a certain trade number I need to reach for the optimize_by_sharp_ratio Custom Fitness Value to work properly?
Thanks,
Ed
Re: Optimize on Sharpe Ratio
Thanks for following up on that Henry.
Just to confirm, is there a bug with optimize_by_sharp_ratio not working for both the daily AND monthly settings on user created signals? Or was it just the Daily?
Thanks
Just to confirm, is there a bug with optimize_by_sharp_ratio not working for both the daily AND monthly settings on user created signals? Or was it just the Daily?
Thanks
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2958 times
Re: Optimize on Sharpe Ratio
We have compared monthly sharpe ratio as report shows only мonthly sharpe ratio.Thanks for following up on that Henry.
Just to confirm, is there a bug with optimize_by_sharp_ratio not working for both the daily AND monthly settings on user created signals? Or was it just the Daily?
Thanks
Re: Optimize on Sharpe Ratio
Hi, if I want an annualized Sharpe ratio, is it correct if I multiply the result by √12 (if setting the period to monthly)? Or √252 (daily period)?We have compared monthly sharpe ratio as report shows only мonthly sharpe ratio.Thanks for following up on that Henry.
Just to confirm, is there a bug with optimize_by_sharp_ratio not working for both the daily AND monthly settings on user created signals? Or was it just the Daily?
Thanks
- Kate MultiCharts
- Posts: 614
- Joined: 21 Oct 2020
- Has thanked: 12 times
- Been thanked: 154 times
Re: Optimize on Sharpe Ratio
Hi soacm,Hi, if I want an annualized Sharpe ratio, is it correct if I multiply the result by √12 (if setting the period to monthly)? Or √252 (daily period)?We have compared monthly sharpe ratio as report shows only мonthly sharpe ratio.Thanks for following up on that Henry.
Just to confirm, is there a bug with optimize_by_sharp_ratio not working for both the daily AND monthly settings on user created signals? Or was it just the Daily?
Thanks
In Strategy Performance Report Annualised Sharpe Ratio = Sharpe Ratio monthly based period * SquareRoot(12).
Values calculated in the script with the built-in SharpeRatio function will be approximately the same as in Strategy Performance Report:
Sharpe Ratio daily based period * SquareRoot(365) ~ Annualised Sharpe Ratio
Sharpe Ratio monthly based period * SquareRoot(12) ~ Annualised Sharpe Ratio
-
- Posts: 47
- Joined: 03 Jan 2023
- Been thanked: 3 times
Re: Optimize on Sharpe Ratio
Kate , are you sure it's square root (365) and not 252 trading days for working out annualised Sharpe ratio. I think as the people above said all outputs should just be automatically converted to annual. Shouldn't have to second-guess this.
Can you just confirm when your running this custom fit value it should be set to the input of 1 and the results from this on a daily chart would be the Sharpe Ratio daily and needs x by 365 for annualised.
Can you just confirm when your running this custom fit value it should be set to the input of 1 and the results from this on a daily chart would be the Sharpe Ratio daily and needs x by 365 for annualised.
- Kate MultiCharts
- Posts: 614
- Joined: 21 Oct 2020
- Has thanked: 12 times
- Been thanked: 154 times
Re: Optimize on Sharpe Ratio
ScottishSpeculator,Kate , are you sure it's square root (365) and not 252 trading days for working out annualised Sharpe ratio. I think as the people above said all outputs should just be automatically converted to annual. Shouldn't have to second-guess this.
Can you just confirm when your running this custom fit value it should be set to the input of 1 and the results from this on a daily chart would be the Sharpe Ratio daily and needs x by 365 for annualised.
SharpeRatio is a pre-built function, the script can be opened in the PowerLanguage Editor for reference. Originally, Sharpe Ratio daily based period is calculated based on 365 days. You can modify the script or create your own to meet your specific needs.
-
- Posts: 47
- Joined: 03 Jan 2023
- Been thanked: 3 times
Re: Optimize on Sharpe Ratio
I think its normal in the quant/trading world to use 252 is it not? Anyone else got an opinion on this? Thought was a set fixed parameter.
Can you guys create a function for the Sortino Ratio?
Can you guys create a function for the Sortino Ratio?