Investing Performance with vs without feesHello traders,
I had a chat with a friend recently who's using a fund manager services to invest for him in some US-based ETFs tracking the US indices.
I showed him using an online tool that those 2% annual fees he's paying to his fund manager are eating a lot of his profit overtime.
As I had some time, I decided to code this simulator in Pinescript because .... why not :)
@RicardoSantos already did that Compound Interest function ()
I added the n parameter being the number of times the interest is compounded per unit of time
Compound interest is calculated using the following formula
CI = P*(1 + R/n) (n*t) – P
Here,
P is the principal amount.
R is the annual interest rate.
t is the time the money is invested or borrowed for.
n is the number of times that interest is compounded per unit t, for example if interest is compounded monthly and t is in years then the value of n would be 12.
If interest is compounded quarterly and t is in years then the value of n would be 4.
For now, the script only works on a yearly chart - I might update it later making it compatible with other chart timeframes - assuming there is some demand for it
If there is, let me know in the comments down below
All the best
Dave
Compound-interest
FunctionCompoundInterestLibrary "FunctionCompoundInterest"
Method for compound interest.
simple_compound(principal, rate, duration) Computes compound interest for given duration.
Parameters:
principal : float, the principal or starting value.
rate : float, the rate of interest.
duration : float, the period of growth.
Returns: float.
variable_compound(principal, rates, duration) Computes variable compound interest for given duration.
Parameters:
principal : float, the principal or starting value.
rates : float array, the rates of interest.
duration : int, the period of growth.
Returns: float array.
simple_compound_array(principal, rates, duration) Computes variable compound interest for given duration.
Parameters:
principal : float, the principal or starting value.
rates : float array, the rates of interest.
duration : int, the period of growth.
Returns: float array.
variable_compound_array(principal, rates, duration) Computes variable compound interest for given duration.
Parameters:
principal : float, the principal or starting value.
rates : float array, the rates of interest.
duration : int, the period of growth.
Returns: float array.
Compound Value @ annual rateBy studying historical data we can know the compounded growth rate of an investment from the inception date. For example if we know that an investment has grown at the rate of 6% in the past and if we expect similar growth in the future also, We can plot this graph to understand whether the current price is underpriced or overpriced as per projected return.
In this graph, it takes the initial close price as a principle and rate from the input and calculates the compound amount at each interval.