daily moving averages on 1m chart from QQQ

onwee

New member
Hello,

My goal is to draw the daily moving averages on my 1m chart from QQQ, even though I only trade SPY. I already do this with SPY daily moving averages and impose them over my 1m candles. Big fan of automatically drawing support/resistance lines as much as possible.

I can draw the SPY daily moving averages on my charts with the following:

Code:
plot SMA5 = SimpleMovingAvg(close (period = AggregationPeriod.Day), 5);
plot SMA10 = SimpleMovingAvg(close (period = AggregationPeriod.Day), 10);
plot SMA21= SimpleMovingAvg(close (period = AggregationPeriod.Day), 21);
plot SMA50= SimpleMovingAvg(close (period = AggregationPeriod.Day), 50);
plot SMA100= SimpleMovingAvg(close (period = AggregationPeriod.Day), 100);
plot SMA200 = SimpleMovingAvg(close (period = AggregationPeriod.Day), 200);
plot SMA250 = SimpleMovingAvg(close (period = AggregationPeriod.Day), 250);

SMA5.SetDefaultColor(Color.LIGHT_GRAY);
SMA10.SetDefaultColor(Color.VIOLET);
SMA21.SetDefaultColor(Color.WHITE);
SMA50.SetDefaultColor(Color.YELLOW);
SMA100.SetDefaultColor(Color.CYAN);
SMA200.SetDefaultColor(Color.DARK_ORANGE);
SMA250.SetDefaultColor(Color.DARK_RED);

I want to do this exact same thing, but specify it's for QQQ and these functions don't seem to accept a ticker as input.

Any ideas appreciated.
 
Solution
Hello,

My goal is to draw the daily moving averages on my 1m chart from QQQ, even though I only trade SPY. I already do this with SPY daily moving averages and impose them over my 1m candles. Big fan of automatically drawing support/resistance lines as much as possible.

I can draw the SPY daily moving averages on my charts with the following:

Code:
plot SMA5 = SimpleMovingAvg(close (period = AggregationPeriod.Day), 5);
plot SMA10 = SimpleMovingAvg(close (period = AggregationPeriod.Day), 10);
plot SMA21= SimpleMovingAvg(close (period = AggregationPeriod.Day), 21);
plot SMA50= SimpleMovingAvg(close (period = AggregationPeriod.Day), 50);
plot SMA100= SimpleMovingAvg(close (period = AggregationPeriod.Day), 100);
plot SMA200 =...
Hello,

My goal is to draw the daily moving averages on my 1m chart from QQQ, even though I only trade SPY. I already do this with SPY daily moving averages and impose them over my 1m candles. Big fan of automatically drawing support/resistance lines as much as possible.

I can draw the SPY daily moving averages on my charts with the following:

Code:
plot SMA5 = SimpleMovingAvg(close (period = AggregationPeriod.Day), 5);
plot SMA10 = SimpleMovingAvg(close (period = AggregationPeriod.Day), 10);
plot SMA21= SimpleMovingAvg(close (period = AggregationPeriod.Day), 21);
plot SMA50= SimpleMovingAvg(close (period = AggregationPeriod.Day), 50);
plot SMA100= SimpleMovingAvg(close (period = AggregationPeriod.Day), 100);
plot SMA200 = SimpleMovingAvg(close (period = AggregationPeriod.Day), 200);
plot SMA250 = SimpleMovingAvg(close (period = AggregationPeriod.Day), 250);

SMA5.SetDefaultColor(Color.LIGHT_GRAY);
SMA10.SetDefaultColor(Color.VIOLET);
SMA21.SetDefaultColor(Color.WHITE);
SMA50.SetDefaultColor(Color.YELLOW);
SMA100.SetDefaultColor(Color.CYAN);
SMA200.SetDefaultColor(Color.DARK_ORANGE);
SMA250.SetDefaultColor(Color.DARK_RED);

I want to do this exact same thing, but specify it's for QQQ and these functions don't seem to accept a ticker as input.

Any ideas appreciated.

price functions accept symbol data.
average functions accept price data.
so they they do accept symbol data.

but if you plot lines from a different symbol, the lines will be far away from the chart symbol price bars, causing the everything to compressed vertically, resulting in what will appear as horizontal lines, far away from the price bars.

here is an example on how to change your formulas

input stock = "QQQ";
input agg = AggregationPeriod.Day;
plot SMA5 = SimpleMovingAvg(close(symbol = stock, period = agg), 5);
 
Last edited:
Solution

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
406 Online
Create Post

Similar threads

Similar threads

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