Thinkscript for Moving Average from different Index/Indicator

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);
 
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:

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

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
 

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
288 Online
Create Post

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top