Shnedi

Buy and hold visualiser

This indicator shows the historical performance of a buy and hold portfolio. The purpose of the indicator is to show
1. the effect of the hold time (time between buying and selling a number of instruments) and
2. the effect of investing all capital at once (lump sum) versus dividing the investment over a number of months or years (cost averaging).

The indicator shows four lines:
- a dotted line at 0 (dollar or any other currency),
- a dotted line at the level of initial investment,
- a blue line that shows the amount of capital after selling at the end of the investment period after a lump sum investment,
- a green line that shows the amount of capital after selling at the end of the investment period after an investment that was done in chunks (cost averaging)

When 'chunks' is set to 1, the green line will match the blue line.
When 'investment' is set to 1, the blue and green lines will show the factor by which the initial investment was multiplied at the end of the investment period.

The effect of the hold time can be easily seen in the following example: Choose SPX (CBOE) as the active instrument, set 'chunks' to 1 and 'months' to 12. Depending on when you bought your portfolio, selling it a year later is like tossing a coin. Set 'months' to 360 and it becomes clear that it doesn't matter when you buy, the value of your portfolio will likely multiply considerably in 30 years, even if you bought everything all at once just before a bear market. It shows that with a long time horizon, you don't have to worry about timing the market.

Continue the example above and set 'chunks' to 12, thus spreading the initial investment over 12 months. The green line shows the cost averaging performance. The blue lump sum line is above the green line most of the time. Increase the chunks to 60 and the difference increases.
开源脚本

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

免责声明

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

想在图表上使用此脚本?