# weekly/monthly high low line

#### Enzo

##### New member
VIP
hi want to ask if there is an indicator to plot the Weekly Monthly High and low not sure where to look thanks in advance

Solution
To plot the previous whatever, make each of the plot statements end with [1] like this
Code:
``plot WH = high(period = AggregationPeriod.WEEK)[1];``
That tells it to use the last value.

-mashume
you can use the aggregation periods for MONTH and WEEK to get the high and low:
Code:
``````declare upper;

plot MH = high(period = AggregationPeriod.MONTH);
plot ML = low(period = AggregationPeriod.MONTH);

plot WH = high(period = AggregationPeriod.WEEK);
plot WL = low(period = AggregationPeriod.WEEK);

MH.SetDefaultColor(color.green);
ML.SetDefaultColor(color.red);
MH.SetLineWeight(2);
ML.SetLineWeight(2);

WH.SetDefaultColor(color.green);
WL.SetDefaultColor(color.red);
WH.SetLineWeight(1);
WL.SetLineWeight(1);``````

Looks like this:

-mashume

Thank you appreciate may i ask if i want to do previous week high/low previous month high/low
i want to use for the ES futures hourly chart thank you

To plot the previous whatever, make each of the plot statements end with [1] like this
Code:
``plot WH = high(period = AggregationPeriod.WEEK)[1];``
That tells it to use the last value.

-mashume

thank you very much you explain very easily to understand have great weekend

To plot the previous whatever, make each of the plot statements end with [1] like this
Code:
``plot WH = high(period = AggregationPeriod.WEEK)[1];``
That tells it to use the last value.

-mashume
This does not plot the previous week high low Why is that?

# Calculate the previous week's high and low
def prevWeekHigh = high(period = AggregationPeriod.WEEK)[1];
def prevWeekLow = low(period = AggregationPeriod.WEEK)[1];

# Add labels for the previous week's high and low
AddLabel(yes, "PrevWeek High: " + AsText(prevWeekHigh), Color.gray);
AddLabel(yes, "PrevWeek Low: " + AsText(prevWeekLow), Color.gray);

This does not plot the previous week high low Why is that?

# Calculate the previous week's high and low
def prevWeekHigh = high(period = AggregationPeriod.WEEK)[1];
def prevWeekLow = low(period = AggregationPeriod.WEEK)[1];

# Add labels for the previous week's high and low
AddLabel(yes, "PrevWeek High: " + AsText(prevWeekHigh), Color.gray);
AddLabel(yes, "PrevWeek Low: " + AsText(prevWeekLow), Color.gray);

Instead of "def .... = ...." , replace them with "plot .... = ...."

87k+ Posts
272 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?