Alright so first off I love this site. It has inspired me to try new things and see how the community decides to participate to validate or invalidate ideas. This idea is I believe novel, so if I am incorrect please let me know to save me the headache of trying to create the wheel so to speak. I have been trading a long time with a background in finance and mathematics so I have always wanted to marry both technical and fundamental analysis. This indicator is hopefully going to be one of many where I try to combine both.
The nuts and bolts of this are pretty straight forward. In this example you add 5 stocks that are in your hypothetical portfolio and their corresponding weights to give a cumulative return on that portfolio. Going forward I plan on measuring the standard deviation of returns in order to find which "portfolios" give the best risk/reward ratios. The possibilities in my opinion are endless. Maybe we use an rsi indicator to measure returns or i dont know im just brain storming but please let me know how the community feels about these ideas.
The bottom indicator shows the cummulative returns for the 5 chosen stocks
The nuts and bolts of this are pretty straight forward. In this example you add 5 stocks that are in your hypothetical portfolio and their corresponding weights to give a cumulative return on that portfolio. Going forward I plan on measuring the standard deviation of returns in order to find which "portfolios" give the best risk/reward ratios. The possibilities in my opinion are endless. Maybe we use an rsi indicator to measure returns or i dont know im just brain storming but please let me know how the community feels about these ideas.
The bottom indicator shows the cummulative returns for the 5 chosen stocks
Code:
# Portfolio Return Analysis
#
# This is the first of several risk to return portfolio analysis indicators I am working on.
#
# 2020-02-29
#
input t1 = "EBAY";
input t2 = "WMT";
input t3 = "AMZN";
input t4 = "COST";
input t5 = "BABA";
input w1 = .2; #hint Weight of Stock 1
input w2 = .2; #hint Weight of Stock 2
input w3 = .2; #hint Weight of Stock 3
input w4 = .2; #hint Weight of Stock 4
input w5 = .2; #hint Weight of Stock 5
def t1_return = close(t1)/close(t1)[1]-1;
def t2_return = close(t2)/close(t2)[1]-1;
def t3_return = close(t3)/close(t3)[1]-1;
def t4_return = close(t4)/close(t4)[1]-1;
def t5_return = close(t5)/close(t5)[1]-1;
plot portfolioWeightedReturns = TotalSum(t1_return*w1+t2_return*w2+t3_return*w3+t4_return*w4+t5_return*w5);