I am trying to create an indicator to a stock chart. I'd like to have a Declare lower indicator with the STD or Linear Regression using a Different stock than the stock of the chart. For example, for the MSFT chart I would like to have indicator showing an indicator of the SPX and it's Moving Avg. The problem I have is I don't know how to insert the price of the SPX for the indicator.
#MovAvg_Any_Symbol_Indicator
Declare Lower;
input length = 20;
input averageType = AverageType.SIMPLE;
input mode = {default "Trend Following", "Reversal"};
DEF Px = ???("SPX");
input price = Px;
plot Avg = MovingAverage(averageType, price, length);
Avg.DefineColor("Up", GetColor(1));
Avg.DefineColor("Down", GetColor(0));
Avg.AssignValueColor(if Avg > Avg[1] then Avg.Color("Up") else Avg.Color("Down"));
#Plot PX;
#MovAvg_Any_Symbol_Indicator
Declare Lower;
input length = 20;
input averageType = AverageType.SIMPLE;
input mode = {default "Trend Following", "Reversal"};
DEF Px = ???("SPX");
input price = Px;
plot Avg = MovingAverage(averageType, price, length);
Avg.DefineColor("Up", GetColor(1));
Avg.DefineColor("Down", GetColor(0));
Avg.AssignValueColor(if Avg > Avg[1] then Avg.Color("Up") else Avg.Color("Down"));
#Plot PX;