# FloorPivotzFormula

##### Member
This is a great pivot tool used by seasoned traders to set support and resistance levels, and top of and bottom of the daily pivot channel set from the previous days trading. expansion and contraction is notable and trading usually hits these resistance levels quite often. I was "Trying to formulate" these lines projected onto the trading day from the previous day [open, close, high and low, not really sure if TOS can pull these values], where Halcyonguy has provided a great bit of knowledge into the script. Thanks and enjoy

Def Pivot = (high + low + close)/3

Def BC = ( high + low ) / 2
Def TC = ( pivot - BC ) + Pivot

Def S1 = 2 x pivot - high
Def S2 = pivot -( high - low )
Def S3 = S1 - ( high - low )
Def S4 = S3 - ( S1 - S2 )

Def R1 = 2 x pivot - low
Def R2 = pivot + (high - low )
Def R3 = R1 + ( high - low )
Def R4 = R3 + ( R2 - R1 )
Code:
``````# Traditional Pivot Points
# Assembled by BenTen at UseThinkScript.com
# Based on the formula from https://www.tradingview.com/support/solutions/43000521824-pivot-points-standard/

input aggregationPeriod = AggregationPeriod.DAY;
def HIGHprev = high(period = aggregationPeriod)[1];
def LOWprev = low(period = aggregationPeriod)[1];
def CLOSEprev = close(period = aggregationPeriod)[1];

# Def Pivot = (high + low + close)/3
plot PP = (HIGHprev + LOWprev + CLOSEprev) / 3;

# Def TC = ( pivot - BC ) + Pivot
plot TC = ( PP – BC ) + PP;

# Def BC = ( high + low ) / 2
Plot BC = (Highprev + LOWprev)/2;

# Def R1 = 2 x pivot – low
plot R1 = PP * 2 - LOWprev;

#Def R2 = pivot + (high - low )
plot R2 = PP + (HIGHprev - LOWprev);

#Def R3 = R1 + ( high - low )
plot R3 = R1 + (HIGHprev - LOWprev);
#plot R3 = PP * 2 + (HIGHprev - 2 * LOWprev);

#Def R4 = R3 + ( R2 - R1 )
Plot R4 =R3 + (R2 -R1)

#Def S1 = 2 x pivot – high
plot S1 = PP * 2 - HIGHprev;

#Def S2 = pivot -( high - low )
plot S2 = PP - (HIGHprev - LOWprev);

#Def S3 = S1 - ( high - low )
Plot S3 = S1 – (HIGHprev – LowPrev)
#plot S3 = PP * 2 - (2 * HIGHprev - LOWprev);

#Def S4 = S3 - ( S1 - S2 )
Plot S4 = S3 – (S1 - S2 )

PP.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
#PP.AssignValueColor(if tc > bc then Color.GREEN else Color.RED);
#TC.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
TC.AssignValueColor(if tc > bc then Color.LIGHT_GREEN else Color.LIGHT_RED);
#BC.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
BC.AssignValueColor(if tc > bc then Color.LIGHT_GREEN else Color.LIGHT_RED);

R1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R4.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

S1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S4.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);``````

Last edited:
Solution
Trying to formulate to plot these lines projected onto the trading day from the previous day [open, close, high and low, not really sure if TOS can pull these values]

Def Pivot = (high + low + close)/3

Def BC = ( high + low ) / 2
Def TC = ( pivot - BC ) + Pivot

Def S1 = 2 x pivot - high
Def S2 = pivot -( high - low )
Def S3 = S1 - ( high - low )
Def S4 = S3 - ( S1 - S2 )

Def R1 = 2 x pivot - low
Def R2 = pivot + (high - low )
Def R3 = R1 + ( high - low )
Def R4 = R3 + ( R2 - R1 )

here is an example pivot study

it uses 2nd aggregation to define a day period. it uses an offset of 1, [1] ,to look back 1 - 2nd agg...
Trying to formulate to plot these lines projected onto the trading day from the previous day [open, close, high and low, not really sure if TOS can pull these values]

Def Pivot = (high + low + close)/3

Def BC = ( high + low ) / 2
Def TC = ( pivot - BC ) + Pivot

Def S1 = 2 x pivot - high
Def S2 = pivot -( high - low )
Def S3 = S1 - ( high - low )
Def S4 = S3 - ( S1 - S2 )

Def R1 = 2 x pivot - low
Def R2 = pivot + (high - low )
Def R3 = R1 + ( high - low )
Def R4 = R3 + ( R2 - R1 )

here is an example pivot study

it uses 2nd aggregation to define a day period. it uses an offset of 1, [1] ,to look back 1 - 2nd agg bar, or 1 day. if your chart is set to hour, the 2nd aggregation will still look back at previous day for data.

----------

i searched the site for pivot and clicked on a couple of links.

Last edited:
Thank you HalcyonGuy, finding a starting point is essential. this version includes more described by F. Ochoa book, placed Top and Bottom of pivot Channel,convert R3 and S3, and add R4 and S4. Still needs notation on the chart

click to open chart --->Ochoa Formula

Code:
``````# Traditional Pivot Points
# Assembled by BenTen at UseThinkScript.com
# Based on the formula from https://www.tradingview.com/support/solutions/43000521824-pivot-points-standard/

input aggregationPeriod = AggregationPeriod.DAY;
def HIGHprev = high(period = aggregationPeriod)[1];
def LOWprev = low(period = aggregationPeriod)[1];
def CLOSEprev = close(period = aggregationPeriod)[1];

# Def Pivot = (high + low + close)/3
plot PP = (HIGHprev + LOWprev + CLOSEprev) / 3;

# Def TC = ( pivot - BC ) + Pivot
plot TC = ( PP – BC ) + PP;

# Def BC = ( high + low ) / 2
Plot BC = (Highprev + LOWprev)/2;

# Def R1 = 2 x pivot – low
plot R1 = PP * 2 - LOWprev;

#Def R2 = pivot + (high - low )
plot R2 = PP + (HIGHprev - LOWprev);

#Def R3 = R1 + ( high - low )
plot R3 = R1 + (HIGHprev - LOWprev);
#plot R3 = PP * 2 + (HIGHprev - 2 * LOWprev);

#Def R4 = R3 + ( R2 - R1 )
Plot R4 =R3 + (R2 -R1)

#Def S1 = 2 x pivot – high
plot S1 = PP * 2 - HIGHprev;

#Def S2 = pivot -( high - low )
plot S2 = PP - (HIGHprev - LOWprev);

#Def S3 = S1 - ( high - low )
Plot S3 = S1 – (HIGHprev – LowPrev)
#plot S3 = PP * 2 - (2 * HIGHprev - LOWprev);

#Def S4 = S3 - ( S1 - S2 )
Plot S4 = S3 – (S1 - S2 )

PP.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
#PP.AssignValueColor(if tc > bc then Color.GREEN else Color.RED);
#TC.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
TC.AssignValueColor(if tc > bc then Color.LIGHT_GREEN else Color.LIGHT_RED);
#BC.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
BC.AssignValueColor(if tc > bc then Color.LIGHT_GREEN else Color.LIGHT_RED);

R1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R4.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

S1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S4.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);``````

Last edited:
All Support and Resistance levels are set from the previous days trades, plus the Pivot Channel, so they dont repaint either. \$HYMC found interested buyers and ran up today

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