#### 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 )

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: