Reference an indicator dataset?


Category:
0
0

Hi All,

I have a really simple question (I hope).  I’m trying to create a EMA study that references the output of an Relative strength indicator, NOT one of the built in options for the EMA (price, close, etc).

I know enough to be dangerous with programming, but I’m missing something in Thinkscript.

Thanks in advance for any help with this!

 

Marked as spam
Posted by (Questions: 1, Answers: 0)
Asked on November 26, 2018 9:01 pm
127 views
0
Private answer

From your question title and your question description I perceive you are trying to solve a problem using tools that don’t exist. From your question title: “Reference an indicator dataset”. This is not possible in Thinkorswim. You can do this in other platforms but it is impossible in Thinkorswim.

From your question description I see that you are trying to create an exponential moving average which is based on the RelativeStrength indicator in Thinkorswim. So you want to add a moving average to the RelativeStrength indicator.

In order to accomplish this you must copy the code from the RelativeStrength indicator and use the plot value of that code to compute your moving average.

Here is the full code copied from the RelativeStrength indicator. I have added two inputs for the moving average and I have added one line to plot the moving average.

declare lower;
input CorrelationWithSecurity = "SPX";
input averageType = AverageType.EXPONENTIAL;
input length = 21;
def close2 = close(CorrelationWithSecurity);
plot RS = if close2 == 0 then 0 else close/close2;
RS.setDefaultColor(GetColor(6));
def sr = CompoundValue("historical data" = RS, "visible data" = if isNaN(sr[1]) then RS else sr[1]);
plot SRatio = sr;
SRatio.setDefaultColor(GetColor(5));
plot ma = MovingAverage(averageType, RS, length);

Screenshot below shows the result.

Attachments:
Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on November 27, 2018 8:03 am