Click here to Login





                                                   Sortino ratio indicator -

  0

0
Kiran
2015-04-23 18:54:33


Per definition, Sortino ratio calculates the Downside Standard Deviation by discarding all +ve returns (or returns > "risk-free rate") in the calculation of Std Dev.

I looked at the code of the Sortino ratio indicator function in http://www.quantshare.com/item-1146-sortino-ratio-of-an-asset
and it seems to be throwing away all returns > Average return (not 0 or risk-free rate). This would distort the interpretation of Sortino ratio.

See the code snippet below (trading object also attached) that states - if(ret[j] < avg) { dsdv = dsdv + Math.Pow(ret[j] - avg, 2); }
- Am I missing something?


VectorD ret = TA.Perf(close, 1);

for(int i=0;i<result.Length;i++)
{
int index = i - (int)period[0] + 1;
double avg = 0;
int count = 0;
if(index <= 0)
{
result[i] = double.NaN;
}
else
{
for(int j=index;j<=i;j++)
{
avg = avg + ret[j];
count++;
}
if(count != 0)
{
avg = avg / count;

double dsdv = 0;
for(int j=index;j<=i;j++)
{
if(ret[j] < avg)
{
dsdv = dsdv + Math.Pow(ret[j] - avg, 2);
}
}
dsdv = (Math.Sqrt(dsdv / (count - 1)) * Math.Sqrt(250)) / 100;
double ret1 = Math.Pow(close[i] / close[index-1], (365.5 / (double)count)) - 1;
if(dsdv != 0)
{
result[i] = ret1 / dsdv;
}
}
else
{
result[i] = 0;
}
}
}

cFunctions.SetForwardAndBackwardBars((int)period[0], 0);





Sortino Ratio of an Asset (by QuantShare, uploaded several months ago)
No notes

Rate an item Rate an item Rate an item Rate an item Rate an item Number of downloads Notes Report an item

QuantShare
2015-04-24 02:34:00

  0

No risk free rate was used in this version, only returns below zero are discarded.


No more messages
0




Reply:

No html code. URLs turn into links automatically.

Type in the trading objects you want to include: - Add Objects
To add a trading object in your message, type in the object name, select it and then click on "Add Objects"










QuantShare

Trading Items
Sortino Ratio of an Asset
Large Block Ratio Indicator
Variance Ratio - Trading Indicator
Bull Bear Ratio - Stock Market Indicator
Volatility Ratio - Technical Indicator

How-to Lessons
How to plot put/call ratio of individual stocks
How to dynamically update the settings of an indicator
How to create a moving average of an indicator
How to add a trading indicator to a chart
How to optimize an indicator in your trading system

Related Forum Threads
VIX Indicator and Put/Call Ratio Indicator for NSE NIFTY
Custom Indicator
Indicator - forward bar value
to write and execute an Indicator
Retrieving or storing previous indicator result.

Blog Posts
How to create a ratio indicator using QS Trading Software
Sharpe Ratio - Part 2
Put-Call Ratio for Individual Stocks
Trading System: Buy stocks with the highest Sharpe ratio
Trading System: Buy Stocks based on their Sharpe Ratio Rank









QuantShare
Product
QuantShare
Features
Create an account
Affiliate Program
Support
Contact Us
Trading Forum
How-to Lessons
Manual
Company
About Us
Privacy
Terms of Use

Copyright © 2024 QuantShare.com
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Google+
Follow us on Google+
RSS Trading Items



Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.