Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- study(title="FXSurf Weekly Pivots 2.0", shorttitle="FXSurf Weekly Pivots 2.0", overlay=true)
- sd = input(true, title="Show Weekly Pivots?")
- sal = input(true, title="Show Additional Levels?")
- //Equations
- pivot = (high + low + close ) / 3.0
- R1 = pivot + 0.382 * (high - low)
- S1 = pivot - 0.382 * (high - low)
- R2 = pivot + 0.618 * (high - low)
- S2 = pivot - 0.618 * (high - low)
- R3 = pivot + 0.786 * (high - low)
- S3 = pivot - 0.786 * (high - low)
- R4 = pivot + 1.0 * (high - low)
- S4 = pivot - 1.0 * (high - low)
- R5 = pivot + 1.382 * (high - low)
- S5 = pivot - 1.382 * (high - low)
- R6= pivot + 1.618 * (high - low)
- S6 = pivot - 1.618 * (high - low)
- R7= pivot + 2.0 * (high - low)
- S7 = pivot - 2.0 * (high - low)
- // Daily line breaks
- dopen = security(tickerid, "W", open)
- // Color
- dcolor= dopen != dopen[1] ? na : gray
- dcolor1= dopen != dopen[1] ? na : blue
- dcolor2= dopen != dopen[1] ? na : olive
- //Daily Pivots
- dtime_pivot = security(tickerid, "W", pivot[1])
- dtime_r7 = security(tickerid, "W", R7[1])
- dtime_r6 = security(tickerid, "W", R6[1])
- dtime_r5 = security(tickerid, "W", R5[1])
- dtime_r4 = security(tickerid, "W", R4[1])
- dtime_r3 = security(tickerid, "W", R3[1])
- dtime_r2 = security(tickerid, "W", R2[1])
- dtime_r1 = security(tickerid, "W", R1[1])
- dtime_s1 = security(tickerid, "W", S1[1])
- dtime_s2 = security(tickerid, "W", S2[1])
- dtime_s3 = security(tickerid, "W", S3[1])
- dtime_s4 = security(tickerid, "W", S4[1])
- dtime_s5 = security(tickerid, "W", S5[1])
- dtime_s6 = security(tickerid, "W", S6[1])
- dtime_s7 = security(tickerid, "W", S7[1])
- //PLotting
- offs_daily = 0
- plot(sd and dtime_pivot ? dtime_pivot : na, title="WP",color=change(dtime_pivot)!=0?na:yellow, transp=0, linewidth=2, offset=offs_daily)
- plotshape(sd and dtime_pivot and dtime_pivot != dtime_pivot[1] ? dtime_pivot : na, text="WP", location=location.absolute, textcolor=yellow)
- plot(sd and dtime_r1 ? dtime_r1 : na, title="R38",color=change(dtime_r1)!=0?na:red, transp=25, linewidth=1, offset=offs_daily)
- plotshape(sd and dtime_r1 and dtime_r1 != dtime_r1[1] ? dtime_r1 : na, text="R38", location=location.absolute, textcolor=red)
- plot(sd and dtime_s1 ? dtime_s1 : na, title="S38",color=change(dtime_s1)!=0?na:lime, transp=25, linewidth=1, offset=offs_daily)
- plotshape(sd and dtime_s1 and dtime_s1 != dtime_s1[1] ? dtime_s1 : na, text="S38", location=location.absolute, textcolor=lime)
- plot(sd and dtime_r2 ? dtime_r2 : na, title="R61",color=change(dtime_r2)!=0?na:red, transp=25, linewidth=1, offset=offs_daily)
- plotshape(sd and dtime_r2 and dtime_r2 != dtime_r2[1] ? dtime_r2 : na, text="R61", location=location.absolute, textcolor=red)
- plot(sd and dtime_s2 ? dtime_s2 : na, title="S61",color=change(dtime_s1)!=0?na:lime, transp=25, linewidth=1, offset=offs_daily)
- plotshape(sd and dtime_s2 and dtime_s2 != dtime_s2[1] ? dtime_s2 : na, text="S61", location=location.absolute, textcolor=lime)
- plot(sd and dtime_r3 ? dtime_r3 : na, title="R78",color=change(dtime_r3)!=0?na:red, transp=25, linewidth=1, offset=offs_daily)
- plotshape(sd and dtime_r3 and dtime_r3 != dtime_r3[1] ? dtime_r3 : na, text="R78", location=location.absolute, textcolor=red)
- plot(sd and dtime_s3 ? dtime_s3 : na, title="S78",color=change(dtime_s3)!=0?na:lime, transp=25, linewidth=1, offset=offs_daily)
- plotshape(sd and dtime_s3 and dtime_s3 != dtime_s3[1] ? dtime_s3 : na, text="S78", location=location.absolute, textcolor=lime)
- plot(sd and dtime_r4 and sal? dtime_r4 : na, title="R100",color=change(dtime_r4)!=0?na:red, transp=25, linewidth=1, offset=offs_daily)
- plotshape(sd and dtime_r4 and dtime_r4 != dtime_r4[1] ? dtime_r4 : na, text="R100", location=location.absolute, textcolor=red)
- plot(sd and dtime_s4 and sal? dtime_s4 : na, title="S100",color=change(dtime_s4)!=0?na:lime, transp=25, linewidth=1, offset=offs_daily)
- plotshape(sd and dtime_s4 and dtime_s4 != dtime_s4[1] ? dtime_s4 : na, text="S100", location=location.absolute, textcolor=lime)
- plot(sd and dtime_r5 and sal? dtime_r5 : na, title="R138 R5",color=change(dtime_r5)!=0?na:red, transp=25, linewidth=1, offset=offs_daily)
- plotshape(sd and dtime_r5 and dtime_r5 != dtime_r5[1] ? dtime_r5 : na, text="R138", location=location.absolute, textcolor=red)
- plot(sd and dtime_s5 and sal? dtime_s5 : na, title="S138 S5",color=change(dtime_s5)!=0?na:lime, transp=25, linewidth=1, offset=offs_daily)
- plotshape(sd and dtime_s5 and dtime_s5 != dtime_s5[1] ? dtime_s5 : na, text="S138", location=location.absolute, textcolor=lime)
- plot(sd and dtime_r6 and sal? dtime_r6 : na, title="R161",color=change(dtime_r6)!=0?na:red, transp=25, linewidth=1, offset=offs_daily)
- plotshape(sd and dtime_r6 and dtime_r6 != dtime_r6[1] ? dtime_r6 : na, text="R161", location=location.absolute, textcolor=red)
- plot(sd and dtime_s6 and sal? dtime_s6 : na, title="S161",color=change(dtime_s6)!=0?na:lime, transp=25, linewidth=1, offset=offs_daily)
- plotshape(sd and dtime_s6 and dtime_s6 != dtime_s6[1] ? dtime_s6 : na, text="S161", location=location.absolute, textcolor=lime)
- plot(sd and dtime_r7 and sal? dtime_r7 : na, title="R200",color=change(dtime_r7)!=0?na:red, transp=25, linewidth=1, offset=offs_daily)
- plotshape(sd and dtime_r7 and dtime_r7 != dtime_r7[1] ? dtime_r7 : na, text="R200", location=location.absolute, textcolor=red)
- plot(sd and dtime_s7 and sal? dtime_s7 : na, title="S200",color=change(dtime_s7)!=0?na:lime, transp=25, linewidth=1, offset=offs_daily)
- plotshape(sd and dtime_s7 and dtime_s7 != dtime_s7[1] ? dtime_s7 : na, text="S200", location=location.absolute, textcolor=lime)
Advertisement
Add Comment
Please, Sign In to add comment