weiwei1467

NMKT/Ghost Pivots

modified from Booker/Palladino Ghost Pivot
adjusted to move pivot forward

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?
//@nmktse mod
// mod from Booker/Palladino Ghost Pivots
//@version=2

//plot(close)

study(title="NMKT/Ghost Pivots", shorttitle="Ghost Pivots", overlay=true)

sd = input(true, title="Show Next Day Pivot")

sw = input(true, title="Show Next Week Pivot")

sm = input(true, title="Show Next Month Pivot")

sy = input(true, title="Show Next Year Pivot")

gp = input(true, title="Show all ghost pivots")

//TODO: Need to change offsets so pivot is drawn ahead of last bar. The offset


intradayTF=1440/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



//tomorrows pivot

dtime_pivot = iff(sd==true, security(tickerid, 'D', hlc3[0]), na)

//Next Weeks pivot

wtime_pivot = iff(sw == true, security(tickerid, 'W', hlc3[0]), na)

//Next Months pivot

mtime_pivot = iff(sm == true, security(tickerid, 'M', hlc3[0]), na)

//Next Year pivot

ytime_pivot = iff(sy == true, security(tickerid, '12M', hlc3[0]), na)


//plots
plotchar(dtime_pivot, color=blue,transp=70, char="-",text="",size=size.small, location = location.absolute, offset=day_offset)
plotchar(wtime_pivot, color=red,transp=70, char="-",text="",size=size.small, location = location.absolute, offset=week_offset)
plotchar(mtime_pivot, color=purple,transp=70, char="-",text="",size=size.small, location = location.absolute, offset=month_offset)
plotchar(ytime_pivot, color=orange,transp=70, char="-",text="", size=size.small, location = location.absolute, offset=year_offset)