ChrisMoody

CM_Pivot Points_Custom

Custom Pivots Indicator - Plots Yearly, Quarterly, Monthly, Weekly, and Daily Levels.

I created this indicator because when you have multiple Pivots on one chart (For Example The Monthly, Weekly, And Daily Pivots), the only way to know exactly what pivot level your looking at is to color ALL S1 Pivots the same color, but create the plot types to look different. For example S1 = Bright Green with Daily being small circles, weekly being bigger circles, and monthly being even bigger crosses for example. This allows you to visually know exactly what pivot levels your looking at…Instantly without thinking. This indicator allows you to Choose any clor you want for any Pivot Level, and Choose The Plot Type.

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 đồ?
//Created by ChrisMoody 6-14-14 
//Daily, Weekly, Monthly, Quarterly, Yearly Pivots 
//calculations from http://en.wikipedia.org/wiki/Pivot_point 
study(title="CM_Pivot Points", shorttitle="CM_Pivots", overlay=true) 
sd = input(true, title="Show Daily Pivots?")
sw = input(false, 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?")
sh3 = input(false, title="Show R3 & S3?")

//Classic Pivot Calculations
pivot = (high + low + close ) / 3.0 
r1 = pivot + (pivot - low)
s1 = pivot - (high - pivot) 
r2 = pivot + (high - low) 
s2 = pivot - (high - low) 
r3 = sh3 and r1 + (high - low) ? r1 + (high - low) : na
s3 = sh3 and s1 - (high - low) ? s1 - (high - low) : na
 
//Daily Pivots 
dtime_pivot = security(tickerid, 'D', pivot[1]) 
dtime_r1 = security(tickerid, 'D', r1[1]) 
dtime_s1 = security(tickerid, 'D', s1[1]) 
dtime_r2 = security(tickerid, 'D', r2[1]) 
dtime_s2 = security(tickerid, 'D', s2[1])
dtime_r3 = security(tickerid, 'D', r3[1])
dtime_s3 = security(tickerid, 'D', s3[1])
 
offs_daily = 0 
plot(sd and dtime_pivot ? dtime_pivot : na, title="Daily Pivot",style=circles, color=fuchsia,linewidth=3) 
plot(sd and dtime_r1 ? dtime_r1 : na, title="Daily R1",style=circles, color=#DC143C,linewidth=3) 
plot(sd and dtime_s1 ? dtime_s1 : na, title="Daily S1",style=circles, color=lime,linewidth=3) 
plot(sd and dtime_r2 ? dtime_r2 : na, title="Daily R2",style=circles, color=maroon,linewidth=3) 
plot(sd and dtime_s2 ? dtime_s2 : na, title="Daily S2",style=circles, color=#228B22,linewidth=3) 
plot(sd and dtime_r3 ? dtime_r3 : na, title="Daily R3",style=circles, color=#FA8072,linewidth=3)
plot(sd and dtime_s3 ? dtime_s3 : na, title="Daily S3",style=circles, color=#CD5C5C,linewidth=3)
 
//Weekly Pivots 
wtime_pivot = security(tickerid, 'W', pivot[1]) 
wtime_R1 = security(tickerid, 'W', r1[1]) 
wtime_S1 = security(tickerid, 'W', s1[1])
wtime_R2 = security(tickerid, 'W', r2[1]) 
wtime_S2 = security(tickerid, 'W', s2[1])
wtime_R3 = security(tickerid, 'W', r3[1]) 
wtime_S3 = security(tickerid, 'W', s3[1])

plot(sw and wtime_pivot ? wtime_pivot : na, title="Weekly Pivot",style=circles, color=fuchsia,linewidth=4) 
plot(sw and wtime_R1 ? wtime_R1 : na, title="Weekly R1",style=circles, color=#DC143C,linewidth=4) 
plot(sw and wtime_S1 ? wtime_S1 : na, title="Weekly S1",style=circles, color=lime,linewidth=4) 
plot(sw and wtime_R2 ? wtime_R2 : na, title="Weekly R2",style=circles, color=maroon,linewidth=4) 
plot(sw and wtime_S2 ? wtime_S2 : na, title="Weekly S2",style=circles, color=#228B22,linewidth=4) 
plot(sw and wtime_R3 ? wtime_R3 : na, title="Weekly R3",style=circles, color=#FA8072,linewidth=4) 
plot(sw and wtime_S3 ? wtime_S3 : na, title="Weekly S3",style=circles, color=#CD5C5C,linewidth=4) 

//Monthly Pivots 
mtime_pivot = security(tickerid, 'M', pivot[1]) 
mtime_R1 = security(tickerid, 'M', r1[1])
mtime_S1 = security(tickerid, 'M', s1[1])
mtime_R2 = security(tickerid, 'M', r2[1])
mtime_S2 = security(tickerid, 'M', s2[1])
mtime_R3 = security(tickerid, 'M', r3[1])
mtime_S3 = security(tickerid, 'M', s3[1])

plot(sm and mtime_pivot ? mtime_pivot : na, title="Monthly Pivot",style=cross, color=fuchsia,linewidth=3) 
plot(sm and mtime_R1 ? mtime_R1 : na, title="Monthly R1",style=cross, color=#DC143C,linewidth=3) 
plot(sm and mtime_S1 ? mtime_S1 : na, title="Monthly S1",style=cross, color=lime,linewidth=3) 
plot(sm and mtime_R2 ? mtime_R2 : na, title="Monthly R2",style=cross, color=maroon,linewidth=3) 
plot(sm and mtime_S2 ? mtime_S2 : na, title="Monthly S2",style=cross, color=#228B22,linewidth=3)
plot(sm and mtime_R3 ? mtime_R3 : na, title="Monthly R3",style=cross, color=#FA8072,linewidth=3)
plot(sm and mtime_S3 ? mtime_S3 : na, title="Monthly S3",style=cross, color=#CD5C5C,linewidth=3)
//Quarterly Pivots
qtime_pivot = security(tickerid, '3M', pivot[1]) 
qtime_R1 = security(tickerid, '3M', r1[1])
qtime_S1 = security(tickerid, '3M', s1[1])
qtime_R2 = security(tickerid, '3M', r2[1])
qtime_S2 = security(tickerid, '3M', s2[1])
qtime_R3 = security(tickerid, '3M', r3[1])
qtime_S3 = security(tickerid, '3M', s3[1])
//Quarterly Pivots Plots
plot(sq and qtime_pivot ? qtime_pivot : na, title="Quarterly Pivot",style=cross, color=fuchsia,linewidth=3) 
plot(sq and qtime_R1 ? qtime_R1 : na, title="Quarterly R1",style=cross, color=#DC143C,linewidth=3) 
plot(sq and qtime_S1 ? qtime_S1 : na, title="Quarterly S1",style=cross, color=lime,linewidth=3) 
plot(sq and qtime_R2 ? qtime_R2 : na, title="Quarterly R2",style=cross, color=maroon,linewidth=3) 
plot(sq and qtime_S2 ? qtime_S2 : na, title="Quarterly S2",style=cross, color=#228B22,linewidth=3)
plot(sq and qtime_R3 ? qtime_R3 : na, title="Quarterly R3",style=cross, color=#FA8072,linewidth=3)
plot(sq and qtime_S3 ? qtime_S3 : na, title="Quarterly S3",style=cross, color=#CD5C5C,linewidth=3)
//Yearly Pivots
ytime_pivot = security(tickerid, '12M', pivot[1]) 
ytime_R1 = security(tickerid, '12M', r1[1])
ytime_S1 = security(tickerid, '12M', s1[1])
ytime_R2 = security(tickerid, '12M', r2[1])
ytime_S2 = security(tickerid, '12M', s2[1])
ytime_R3 = security(tickerid, '12M', r3[1])
ytime_S3 = security(tickerid, '12M', s3[1])
//Yearly Pivots Plots
plot(sy and ytime_pivot ? ytime_pivot : na, title="Yearly Pivot",style=cross, color=fuchsia,linewidth=3) 
plot(sy and ytime_R1 ? ytime_R1 : na, title="Yearly R1",style=cross, color=#DC143C,linewidth=3) 
plot(sy and ytime_S1 ? ytime_S1 : na, title="Yearly S1",style=cross, color=lime,linewidth=3) 
plot(sy and ytime_R2 ? ytime_R2 : na, title="Yearly R2",style=cross, color=maroon,linewidth=3) 
plot(sy and ytime_S2 ? ytime_S2 : na, title="Yearly S2",style=cross, color=#228B22,linewidth=3)
plot(sy and ytime_R3 ? ytime_R3 : na, title="Yearly R3",style=cross, color=#FA8072,linewidth=3)
plot(sy and ytime_S3 ? ytime_S3 : na, title="Yearly S3",style=cross, color=#CD5C5C,linewidth=3)