Eminaest

Eminaest Pivots V2

Simple Pivot Points plotting script.

You can choose to plot Daily, Weekly and Monthly Pivot Points. Separate or two of them or all together.
Mã nguồn mở

Với tinh thần TradingView, tác giả của tập lệnh này đã xuất bản nó dưới dạng mã nguồn mở, vì vậy các nhà giao dịch có thể hiểu và xác minh nó. Chúc mừng tác giả! Bạn có thể sử dụng mã này miễn phí, nhưng việc sử dụng lại mã này trong một ấn phẩm chịu sự điều chỉnh của Nội quy nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.

Thông báo miễn trừ trách nhiệm

Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?
study(title="Eminaest Pivots V2", shorttitle="EPiPo", overlay=true)
//timeframe = input("D", type=resolution)
da = input(true, title="Show Daily Pivots?")
we = input(true, title="Show Weekly Pivots?")
mo = input(true, title="Show Monthly Pivots?")
//l3 = input(false, title="Show R3 & S3?")

//Daily
sopen = security(tickerid, "D", open [1])
shigh = security(tickerid, "D", high [1])
slow = security(tickerid, "D", low [1])
sclose = security(tickerid, "D", close [1])

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

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

//Color
scolor=sopen != sopen[1] ? na : black
scolor1=sopen != sopen[1] ? na : red
scolor2=sopen != sopen[1] ? na : green

wcolor=wopen != wopen[1] ? na : black
wcolor1=wopen != wopen[1] ? na : red
wcolor2=wopen != wopen[1] ? na : green

mcolor=mopen != mopen[1] ? na : black
mcolor1=mopen != mopen[1] ? na : red
mcolor2=mopen != mopen[1] ? na : green

//Pivot Calculation
//Daily
pivot = (shigh + slow + sclose) / 3
r1 = (pivot + pivot) - slow
s1 = (pivot + pivot) - shigh 
r2 = pivot + (shigh - slow)
s2 = pivot - (shigh - slow)
r3 = r1 + (shigh - slow)
s3 = s1 - (shigh - slow)

//Weekly
wpivot = (whigh + wlow + wclose) / 3
wr1 = wpivot + (wpivot - wlow)
ws1 = wpivot - (whigh - wpivot) 
wr2 = wpivot + (whigh - wlow) 
ws2 = wpivot - (whigh - wlow) 
wr3 = wr1 + (whigh - wlow)
ws3 = ws1 - (whigh - wlow)

//Monthly
mpivot = (mhigh + mlow + mclose) / 3
mr1 = mpivot + (mpivot - mlow)
ms1 = mpivot - (mhigh - mpivot) 
mr2 = mpivot + (mhigh - mlow) 
ms2 = mpivot - (mhigh - mlow) 
mr3 = mr1 + (mhigh - mlow)
ms3 = ms1 - (mhigh - mlow)

//Plotting lines
//Daily
plot(da and pivot ? pivot : na, color=scolor, style=circles)
plot(da and s1 ? s1 : na, color=scolor1,style=circles)
plot(da and s2 ? s2 : na, color=scolor1,style=circles)
plot(da and s3 ? s3 : na, color=scolor1,style=circles)
plot(da and r1 ? r1 : na, color=scolor2,style=circles)
plot(da and r2 ? r2 : na, color=scolor2,style=circles)
plot(da and r3 ? r3 : na, color=scolor2,style=circles)

//Weekly
plot(we and wpivot ? wpivot : na, color=wcolor, linewidth=1)
plot(we and ws1 ? ws1 : na, color=wcolor1, linewidth=1)
plot(we and ws2 ? ws2 : na, color=wcolor1, linewidth=1)
plot(we and ws3 ? ws3 : na, color=wcolor1, linewidth=1)
plot(we and wr1 ? wr1 : na, color=wcolor2, linewidth=1)
plot(we and wr2 ? wr2 : na, color=wcolor2, linewidth=1)
plot(we and wr3 ? wr3 : na, color=wcolor2, linewidth=1)

//Monthly
plot(mo and mpivot ? mpivot : na, color=mcolor, linewidth=2)
plot(mo and ms1 ? ms1 : na, color=mcolor1, linewidth=2)
plot(mo and ms2 ? ms2 : na, color=mcolor1, linewidth=2)
plot(mo and ms3 ? ms3 : na, color=mcolor1, linewidth=2)
plot(mo and mr1 ? mr1 : na, color=mcolor2, linewidth=2)
plot(mo and mr2 ? mr2 : na, color=mcolor2, linewidth=2)
plot(mo and mr3 ? mr3 : na, color=mcolor2, linewidth=2)