Pivots Daily Weekly Monthly Yearly

Daily, Weekly, Monthly and yearly pivot lines
Just the pivot lines without the support and resistance lines
Remove from Favorite Scripts Add to Favorite Scripts
//@Pivots Daily, Weekly, Monthly, Yearly

study(title="Pivot line", shorttitle="Pivots", overlay=true)

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

dopen = security(tickerid, "D", open[1])
dhigh = security(tickerid, "D", high[1])
dlow = security(tickerid, "D" , low[1])

dcolor=dopen != dopen[1] ? na : black
dpivot = (dopen + dhigh + dlow ) / 3.0 
plot(sd and dpivot ? dpivot:na,title="Daily Pivot", style=line, color=dcolor, linewidth=2)

wopen = security(tickerid, "W", open[1])
whigh = security(tickerid, "W", high[1])
wlow = security(tickerid, "W", low[1])

wcolor=wopen != wopen[1] ? na : blue
wpivot = (wopen + whigh + wlow ) / 3.0 
plot(sw and wpivot ? wpivot:na,title="Weekly Pivot", style=line, color=wcolor, linewidth=2)

mopen = security(tickerid, "M", open[1])
mhigh = security(tickerid, "M", high[1])
mlow = security(tickerid, "M", low[1])

mcolor=mopen != mopen[1] ? na : black
mpivot = (mopen + mhigh + mlow ) / 3.0 
plot(sm and mpivot ? mpivot:na,title="Monthly Pivot", style=line, color=mcolor, linewidth=2)

yopen = security(tickerid, "12M", open[1])
yhigh = security(tickerid, "12M", high[1])
ylow = security(tickerid, "12M", low[1])

ycolor=yopen != yopen[1] ? na : red
ypivot = (yopen + yhigh + ylow ) / 3.0 
plot(sm and ypivot ? ypivot:na,title="Yearly Pivot", style=line, color=ycolor, linewidth=2)
Please note these pivots are calculated on the open price of the previous period and not the close as is the standard methodology.
Ideas Scripts Chart
United States
United Kingdom
Home Stock Screener Forex Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Account and Billing Sign Out