Thinkscript for Moving Average from different Index/Indicator

itsthefriz

itsthefriz

New member
Hey I'm working on a simple Thinkscript that is able to pull a moving average from a different chart. Like...say I want to see a 7 period moving average of the spoos up/down difference overlaid on top of the SPX.

Unfortunately I'm not much of a coder, and most of my experience with coding is with VBA...and the VBA resources and examples are much better. If any of you can take a quick look at this I'd appreciate it. I believe the code is wrong because the moving average seems to change based on what the main chart is.

declare lower;
input symbol = {default "$ADSPD"};
input price = FundamentalType.CLOSE;
input aggregationPeriod = AggregationPeriod.DAY;
input length = 7;
input averageType = AverageType.SIMPLE;

plot MovAvg = MovingAverage(averageType, Fundamental(price, period = aggregationPeriod), length);
 
rad14733

rad14733

Well-known member
VIP
I'm not sure you're going to be able to plot another stock symbol either on a chart or in a lower indicator from within a study, aside from using the Comparison Study... Your best bet is to bounce it off TOS Customer/Technical Service before wasting any more time on this...

Edited to add: Well, you can pull other symbols in after all... Below is what I tested with...

Ruby:
declare lower;
plot Data = close("AMD");
 
Last edited:
itsthefriz

itsthefriz

New member
I actually had the study working however it wasn't giving me the results I was looking for. I might play around with it this weekend and see if I can figure out what I did and, if so, I'll post it
 

Similar threads

Top