Multi Time Frame Moving Average Add on Lables

bobby168

New member
Hey Guys,
Very new to here, Was wondering if someone could help me figure out why
Code: http://tos.mx/EpvMk2M
Below is what I wrote,


Code:
def SMA4H200 = SimpleMovingAvg(close (period = AggregationPeriod.FOUR_HOURS), 200);
AddLabel(yes, "4H200=" + Round(SMA4H200,0) , Color.magenta);
def SMA4H50 = SimpleMovingAvg(close (period = AggregationPeriod.FOUR_HOURS), 50);
AddLabel(yes, "4H50=" + Round(SMA4H50,0) , Color.magenta);
def SMAD200 = SimpleMovingAvg(close (period = AggregationPeriod.DAY), 200);
AddLabel(yes, "D200=" + Round(SMAD200,0) , Color.YELLOW);
def SMAD50 = SimpleMovingAvg(close (period = AggregationPeriod.DAY), 50);
AddLabel(yes, "D50=" + Round(SMAD50,0) , Color.YELLOW);
def SMAW200 = SimpleMovingAvg(close (period = AggregationPeriod.WEEK), 200);
AddLabel(yes, "W200=" + Round(SMAW200,0) , Color.CYAN);
def SMAW50 = SimpleMovingAvg(close (period = AggregationPeriod.WEEK), 50);
AddLabel(yes, "W50=" + Round(SMAW50,0) , Color.CYAN);

Everythign seems to be working fine ;however, on the weekly add on labels I keep on getting N/A on the 1mn time frame and I am not sure why it is giving this issue
Would appreciate it if someone could tell me what im doing wrong.
 
Solution
Hey Guys,
Very new to here, Was wondering if someone could help me figure out why
Code: http://tos.mx/EpvMk2M
Below is what I wrote,


Code:
def SMA4H200 = SimpleMovingAvg(close (period = AggregationPeriod.FOUR_HOURS), 200);
AddLabel(yes, "4H200=" + Round(SMA4H200,0) , Color.magenta);
def SMA4H50 = SimpleMovingAvg(close (period = AggregationPeriod.FOUR_HOURS), 50);
AddLabel(yes, "4H50=" + Round(SMA4H50,0) , Color.magenta);
def SMAD200 = SimpleMovingAvg(close (period = AggregationPeriod.DAY), 200);
AddLabel(yes, "D200=" + Round(SMAD200,0) , Color.YELLOW);
def SMAD50 = SimpleMovingAvg(close (period = AggregationPeriod.DAY), 50);
AddLabel(yes, "D50=" + Round(SMAD50,0) , Color.YELLOW);
def SMAW200 = SimpleMovingAvg(close (period =...
Hey Guys,
Very new to here, Was wondering if someone could help me figure out why
Code: http://tos.mx/EpvMk2M
Below is what I wrote,


Code:
def SMA4H200 = SimpleMovingAvg(close (period = AggregationPeriod.FOUR_HOURS), 200);
AddLabel(yes, "4H200=" + Round(SMA4H200,0) , Color.magenta);
def SMA4H50 = SimpleMovingAvg(close (period = AggregationPeriod.FOUR_HOURS), 50);
AddLabel(yes, "4H50=" + Round(SMA4H50,0) , Color.magenta);
def SMAD200 = SimpleMovingAvg(close (period = AggregationPeriod.DAY), 200);
AddLabel(yes, "D200=" + Round(SMAD200,0) , Color.YELLOW);
def SMAD50 = SimpleMovingAvg(close (period = AggregationPeriod.DAY), 50);
AddLabel(yes, "D50=" + Round(SMAD50,0) , Color.YELLOW);
def SMAW200 = SimpleMovingAvg(close (period = AggregationPeriod.WEEK), 200);
AddLabel(yes, "W200=" + Round(SMAW200,0) , Color.CYAN);
def SMAW50 = SimpleMovingAvg(close (period = AggregationPeriod.WEEK), 50);
AddLabel(yes, "W50=" + Round(SMAW50,0) , Color.CYAN);

Everythign seems to be working fine ;however, on the weekly add on labels I keep on getting N/A on the 1mn time frame and I am not sure why it is giving this issue
Would appreciate it if someone could tell me what im doing wrong.


probably too many bars to display. there are limits as to how many bars TOS can pull data from.

at 1 minute, there are 390 bars/day.
over a year, 252 days, there are 98,280 bars.
200 weeks is 200*5*390 = 390,000 bars

change the time of the week chart to something longer, hour, 4 hour, day,.. and see what works,
 
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
291 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