# Extend Horizontal Line on a Daily Chart based on Monthly High, Low and Close

#### shakib3585

##### Active member
VIP
Hello All,

I am trying to extend a Horizontal line on the left based of Calculated Daily Pivots from Previous Month's High, Low and Close. I plan to draw the lines on a Daily Chart.

My definition of the Daily Pivot Based on Monthly Aggregation is as follows,

PP = HLC3[1];
R = PP + (High[1] - Low[1]);
S = PP - (High[1] - Low[1]);

I only intend to draw the three lines on the current Month only and extend them to the left. I do not wish to draw any Previous Month's Pivots based off the calculation. Please help.

Thanks,

Faisal

Solution
Hello All,

I am trying to extend a Horizontal line on the left based of Calculated Daily Pivots from Previous Month's High, Low and Close. I plan to draw the lines on a Daily Chart.

My definition of the Daily Pivot Based on Monthly Aggregation is as follows,

PP = HLC3[1];
R = PP + (High[1] - Low[1]);
S = PP - (High[1] - Low[1]);

I only intend to draw the three lines on the current Month only and extend them to the left. I do not wish to draw any Previous Month's Pivots based off the calculation. Please help.

Thanks,

Faisal

See if this is what you wanted: monthly pivots points, as you defined then, plotted on a daily chart. You can change the displace to lookback at other months.

Code:
``input showonlytoday =...``
Hello All,

I am trying to extend a Horizontal line on the left based of Calculated Daily Pivots from Previous Month's High, Low and Close. I plan to draw the lines on a Daily Chart.

My definition of the Daily Pivot Based on Monthly Aggregation is as follows,

PP = HLC3[1];
R = PP + (High[1] - Low[1]);
S = PP - (High[1] - Low[1]);

I only intend to draw the three lines on the current Month only and extend them to the left. I do not wish to draw any Previous Month's Pivots based off the calculation. Please help.

Thanks,

Faisal
Here is some code that provides you with the basic syntax to get started.
change the aggregation to month

Hello All,

I am trying to extend a Horizontal line on the left based of Calculated Daily Pivots from Previous Month's High, Low and Close. I plan to draw the lines on a Daily Chart.

My definition of the Daily Pivot Based on Monthly Aggregation is as follows,

PP = HLC3[1];
R = PP + (High[1] - Low[1]);
S = PP - (High[1] - Low[1]);

I only intend to draw the three lines on the current Month only and extend them to the left. I do not wish to draw any Previous Month's Pivots based off the calculation. Please help.

Thanks,

Faisal

what does a daily pivot have to do with monthly price levels?

this doesn't make any sense
....Daily Pivot Based on Monthly Aggregation is as follows,....

if you are using monthly data, you will have a monthly pivot.

...only current month, but extend to the left? which is it?
do you really want lines extending to the left? back in time, before the event?

i think it would be simpler if you explained what you want ,
with the desired data time (monthly)
and not mention chart time( daily)

what does a daily pivot have to do with monthly price levels?

this doesn't make any sense
....Daily Pivot Based on Monthly Aggregation is as follows,....

if you are using monthly data, you will have a monthly pivot.

...only current month, but extend to the left? which is it?
do you really want lines extending to the left? back in time, before the event?

i think it would be simpler if you explained what you want ,
with the desired data time (monthly)
and not mention chart time( daily)
sorry for the confusion

Hello All,

I am trying to extend a Horizontal line on the left based of Calculated Daily Pivots from Previous Month's High, Low and Close. I plan to draw the lines on a Daily Chart.

My definition of the Daily Pivot Based on Monthly Aggregation is as follows,

PP = HLC3[1];
R = PP + (High[1] - Low[1]);
S = PP - (High[1] - Low[1]);

I only intend to draw the three lines on the current Month only and extend them to the left. I do not wish to draw any Previous Month's Pivots based off the calculation. Please help.

Thanks,

Faisal

See if this is what you wanted: monthly pivots points, as you defined then, plotted on a daily chart. You can change the displace to lookback at other months.

Code:
``````input showonlytoday = yes;
input agg = AggregationPeriod.MONTH;
input displace = 1;

def pp_;
def R_;
def S_;
if showonlytoday and
(!IsNaN(close(period = agg)[-1]) or
IsNaN(close)) {
pp_ =   Double.NaN;
R_ = Double.NaN;
S_ = Double.NaN;
} else {
pp_ = hlc3(period = agg)[displace];
R_  = pp_ + (high(period = agg)[displace] - low(period = agg)[displace]);
S_  = pp_ - (high(period = agg)[displace] - low(period = agg)[displace]);
}

plot pp = HighestAll(pp_);
plot R  = HighestAll(R_);
plot S  = HighestAll(S_);
pp.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
;``````

See if this is what you wanted: monthly pivots points, as you defined then, plotted on a daily chart. You can change the displace to lookback at other months.
Thanks a ton @SleepyZ

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