gverdu

Posible Next Pivots Script

//@posible next pivot
//based in other codes
//Modified by gverdu


study(title="Posible Next Pivots", shorttitle="Next Pivots", overlay=true)

sd = input(false, title="Show Daily Pivots?")
sw = input(true, title="Show Weekly Pivots?")
sm = input(false, title="Show Monthly Pivots?")
sq = input(false, title="Show Quarterly Pivots?")
sy = input(false, title="Show Yearly Pivots?")

pivot = (high + low + close ) / 3.0

intradayTF=1000/interval
dTF=1
wTF=1
mTF=1

TF=isintraday? intradayTF: isdaily? dTF:isweekly? wTF:ismonthly? mTF:0


daily=isintraday?TF:dTF
weekly=isintraday?daily*7:wTF
monthly=isintraday?weekly*4:mTF
yearly=isintraday?monthly*12:12

// changes depending on the current time frame being displayed.
day_offset = daily
week_offset = weekly
month_offset =monthly
year_offset = yearly



//day pivot

dtime_pivot = security(tickerid, 'D', pivot)

plot(sd and dtime_pivot ? dtime_pivot: na, color=blue,title="Next Day Pivot",style=line, linewidth=3, offset=day_offset)

//Next Weeks pivot
wtime_pivot = security(tickerid, 'W', pivot)

plot(sw and wtime_pivot ? wtime_pivot : na, title="Next Weekly Pivot",style=line, color=red,linewidth=3, offset=week_offset)
//Next Months pivot
mtime_pivot = security(tickerid, 'M', pivot)
plot(sm and mtime_pivot ? mtime_pivot: na, color=purple,title="Next Month Pivot",style=line, linewidth=3, offset=month_offset)

//Next Year pivot
ytime_pivot = security(tickerid, '12M', pivot)
plot(sy and ytime_pivot ? ytime_pivot: na, color=orange, title="Next Year Pivot",style=line,linewidth=3, offset=year_offset)
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?
//@posible next pivot
//based in other codes
//Modified by gverdu


study(title="Posible Next Pivots", shorttitle="Next Pivots", overlay=true)

sd = input(false, title="Show Daily Pivots?")
sw = input(true, title="Show Weekly Pivots?")
sm = input(false, title="Show Monthly Pivots?")
sq = input(false, title="Show Quarterly Pivots?")
sy = input(false, title="Show Yearly Pivots?")

pivot = (high + low + close ) / 3.0 

intradayTF=1000/interval
dTF=1
wTF=1
mTF=1

TF=isintraday? intradayTF: isdaily? dTF:isweekly? wTF:ismonthly? mTF:0


daily=isintraday?TF:dTF
weekly=isintraday?daily*7:wTF
monthly=isintraday?weekly*4:mTF
yearly=isintraday?monthly*12:12

// changes depending on the current time frame being displayed.
day_offset = daily
week_offset = weekly
month_offset =monthly
year_offset = yearly



//day pivot

dtime_pivot = security(tickerid, 'D', pivot[0]) 

plot(sd and dtime_pivot ? dtime_pivot: na, color=blue,title="Next Day Pivot",style=line, linewidth=3, offset=day_offset)

//Next Weeks pivot
wtime_pivot = security(tickerid, 'W', pivot[0]) 

plot(sw and wtime_pivot ? wtime_pivot : na, title="Next Weekly Pivot",style=line, color=red,linewidth=3, offset=week_offset)
//Next Months pivot
mtime_pivot = security(tickerid, 'M', pivot[0]) 
plot(sm and mtime_pivot ? mtime_pivot: na, color=purple,title="Next Month Pivot",style=line, linewidth=3, offset=month_offset)

//Next Year pivot
ytime_pivot = security(tickerid, '12M', pivot[0]) 
plot(sy and ytime_pivot ? ytime_pivot: na, color=orange, title="Next Year Pivot",style=line,linewidth=3, offset=year_offset)