CapnOscar

CapnPivots

63
Daily Pivots
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?
study(title="CapnPivots", shorttitle="CapnPivots", overlay=true)

yesterday_close = security(tickerid, "D",close[1])
yesterday_open = security(tickerid, "D",open[1])
today_open = security(tickerid, "D",open)
yesterday_high = security(tickerid, "D",high[1])
yesterday_low = security(tickerid, "D",low[1])
day_high = security(tickerid, "D",high)
day_low = security(tickerid, "D",low)

//yc = plot(yesterday_close, color=blue)
//yo = plot(yesterday_open, color=blue)
//to = plot(today_open, color=red)
//yh = plot(yesterday_high, color=blue)
//yl = plot(yesterday_low, color=blue)
//dh = plot(day_high, color=blue)
//dl = plot(day_low, color=blue)

D = (day_high - day_low)
Q = (yesterday_high - yesterday_low)
P = (yesterday_high + yesterday_low + yesterday_close) / 3
R1 = (2*P)-yesterday_low
S1 = (2*P)-yesterday_high
R2 = P+(yesterday_high - yesterday_low)
S2 = P-(yesterday_high - yesterday_low)

H4 = (Q*0.55)+yesterday_close
H3 = (Q*0.27)+yesterday_close
R3 = (2*P)+(yesterday_high-(2*yesterday_low))
S3 = (2*P)-((2* yesterday_high)-yesterday_low)


pv = plot(P, color=black)
plr1 = plot(R1, color=red)
plr2 = plot(R2, color=red)
plr3 = plot(R3, color=red)
pls1 = plot(S1, color=green)
pls2 = plot(S2, color=green)
pls3 = plot(S3, color=green)

plh4 = plot(H4, color=purple)
plh3 = plot(H3, color=purple)