# 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);
def SMAD50 = SimpleMovingAvg(close (period = AggregationPeriod.DAY), 50);
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);
def SMAD50 = SimpleMovingAvg(close (period = AggregationPeriod.DAY), 50);
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);
def SMAD50 = SimpleMovingAvg(close (period = AggregationPeriod.DAY), 50);
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:

87k+ Posts
380 Online

## The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
• Exclusive indicators
• Proven strategies & setups
• Private Discord community
• Exclusive members-only content
• 1 full year of unlimited support

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?