FloorPivotzFormula

Adeodatus

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/
# Added Ochoa Formula variables by Adeodatus

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
https://usethinkscript.com/threads/...ts-indicator-for-thinkorswim.4860/#post-44895

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
https://usethinkscript.com/threads/...ts-indicator-for-thinkorswim.4860/#post-44895

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:
Solution

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

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/
# Added Ochoa Formula variables by Adeodatus

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:

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
429 Online
Create Post

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