SparkyFlary

Risk Position Sizing tool using Coefficient of Variation

SparkyFlary 已更新   
A way to manage portfolio risk using relative standard deviation, also known as coefficient of variation. This tool tells you how much of each stock in shares and in value to buy adjusted for their volatility risk for a given starting account capital. A problem many people have is how to diversify an account and adjusting it for the risk involved in each equity. Many would put in an equal amount of capital value into each share but is it really equal if some equities have more risk than others? A solution is to adjust the portfolio by giving less weight to those that are more volatile or risky. It's done by using a starting percent of the account, preferably a small percent of it, and buying up shares with that same amount for each equity. Each equity will also be divided by the COV to risk adjust the portfolio by giving less weight to the more volatile stocks. This is done until as much of the initial capital in the account as possible is spent.

COV is how far away the price is from the mean or average. The further the price is from the mean the more risk or volatility there is. It uses standard deviation in its calculation. The problem with SD and ATR is that they are not relative to the past or to other equities to compare to. An application where COV can be used is risk portfolio management formulas. This does not take into account correlation or other equation parts in some portfolio management formulas but only the risk or volatility, the default volatility length is mostly arbitrary, and the lower risk stocks may end up being the slowest in performance.

The text label will show how many shares will be bought and how much value each equity will have. At the end it will show the initial capital that was started off with, the total shares bought, the total value of all the shares, and the amount of capital left over. If the sources are not blank then they will be used, to blank them you will need to reset the settings to default otherwise they might still be read. If you want to add more than the given 10 equity spaces to the portfolio then you will need to add in the code manually and add it to the chart. The denominator is perhaps the important part in these types of risk position sizing tools, you can change to other things such as risk-reward ratio instead of volatility or change the volatility type, etc.
版本注释:
fixed a problem with the volatility somehow existing despite empty input symbol sources which ended up throwing things off
开源脚本

本着真正的TradingView精神,该脚本的作者将其开源发布,以便交易者可以理解和验证它。为作者喝彩!您可以免费使用它,但在出版物中重复使用此代码受网站规则的约束。 您可以收藏它以在图表上使用。

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。

想在图表上使用此脚本?