TradingView
gverdu
Jul 16, 2016 11:24 PM

Posible Next Pivots Script 

Silver/U.S. DollarFXCM

Description

//@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)
Comments
ilesanmipepsi
Hello. I just found your script, and I'm currently testing it. Will feed you back my result. Thanks for sharing.
More