FXSurf

FXSurf Weekly Fib Pivots

Sep 25th, 2020
350
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.49 KB | None | 0 0
  1.  
  2. study(title="FXSurf Weekly Pivots 2.0", shorttitle="FXSurf Weekly Pivots 2.0", overlay=true)
  3. sd = input(true, title="Show Weekly Pivots?")
  4. sal = input(true, title="Show Additional Levels?")
  5.  
  6. //Equations
  7. pivot = (high + low + close ) / 3.0
  8. R1 = pivot + 0.382 * (high - low)
  9. S1 = pivot - 0.382 * (high - low)
  10. R2 = pivot + 0.618 * (high - low)
  11. S2 = pivot - 0.618 * (high - low)
  12. R3 = pivot + 0.786 * (high - low)
  13. S3 = pivot - 0.786 * (high - low)
  14. R4 = pivot + 1.0 * (high - low)
  15. S4 = pivot - 1.0 * (high - low)
  16. R5 = pivot + 1.382 * (high - low)
  17. S5 = pivot - 1.382 * (high - low)
  18. R6= pivot + 1.618 * (high - low)
  19. S6 = pivot - 1.618 * (high - low)
  20. R7= pivot + 2.0 * (high - low)
  21. S7 = pivot - 2.0 * (high - low)
  22.  
  23. // Daily line breaks
  24. dopen = security(tickerid, "W", open)
  25.  
  26. // Color
  27. dcolor= dopen != dopen[1] ? na : gray
  28. dcolor1= dopen != dopen[1] ? na : blue
  29. dcolor2= dopen != dopen[1] ? na : olive
  30.  
  31. //Daily Pivots
  32. dtime_pivot = security(tickerid, "W", pivot[1])
  33. dtime_r7 = security(tickerid, "W", R7[1])
  34. dtime_r6 = security(tickerid, "W", R6[1])
  35. dtime_r5 = security(tickerid, "W", R5[1])
  36. dtime_r4 = security(tickerid, "W", R4[1])
  37. dtime_r3 = security(tickerid, "W", R3[1])
  38. dtime_r2 = security(tickerid, "W", R2[1])
  39. dtime_r1 = security(tickerid, "W", R1[1])
  40. dtime_s1 = security(tickerid, "W", S1[1])
  41. dtime_s2 = security(tickerid, "W", S2[1])
  42. dtime_s3 = security(tickerid, "W", S3[1])
  43. dtime_s4 = security(tickerid, "W", S4[1])
  44. dtime_s5 = security(tickerid, "W", S5[1])
  45. dtime_s6 = security(tickerid, "W", S6[1])
  46. dtime_s7 = security(tickerid, "W", S7[1])
  47.  
  48.  
  49.  
  50. //PLotting
  51. offs_daily = 0
  52. plot(sd and dtime_pivot ? dtime_pivot : na, title="WP",color=change(dtime_pivot)!=0?na:yellow, transp=0, linewidth=2, offset=offs_daily)
  53. plotshape(sd and dtime_pivot and dtime_pivot != dtime_pivot[1] ? dtime_pivot : na, text="WP", location=location.absolute, textcolor=yellow)
  54.  
  55. plot(sd and dtime_r1 ? dtime_r1 : na, title="R38",color=change(dtime_r1)!=0?na:red, transp=25, linewidth=1, offset=offs_daily)
  56. plotshape(sd and dtime_r1 and dtime_r1 != dtime_r1[1] ? dtime_r1 : na, text="R38", location=location.absolute, textcolor=red)
  57.  
  58. plot(sd and dtime_s1 ? dtime_s1 : na, title="S38",color=change(dtime_s1)!=0?na:lime, transp=25, linewidth=1, offset=offs_daily)
  59. plotshape(sd and dtime_s1 and dtime_s1 != dtime_s1[1] ? dtime_s1 : na, text="S38", location=location.absolute, textcolor=lime)
  60.  
  61.  
  62. plot(sd and dtime_r2 ? dtime_r2 : na, title="R61",color=change(dtime_r2)!=0?na:red, transp=25, linewidth=1, offset=offs_daily)
  63. plotshape(sd and dtime_r2 and dtime_r2 != dtime_r2[1] ? dtime_r2 : na, text="R61", location=location.absolute, textcolor=red)
  64.  
  65.  
  66. plot(sd and dtime_s2 ? dtime_s2 : na, title="S61",color=change(dtime_s1)!=0?na:lime, transp=25, linewidth=1, offset=offs_daily)
  67. plotshape(sd and dtime_s2 and dtime_s2 != dtime_s2[1] ? dtime_s2 : na, text="S61", location=location.absolute, textcolor=lime)
  68.  
  69.  
  70. plot(sd and dtime_r3 ? dtime_r3 : na, title="R78",color=change(dtime_r3)!=0?na:red, transp=25, linewidth=1, offset=offs_daily)
  71. plotshape(sd and dtime_r3 and dtime_r3 != dtime_r3[1] ? dtime_r3 : na, text="R78", location=location.absolute, textcolor=red)
  72.  
  73.  
  74. plot(sd and dtime_s3 ? dtime_s3 : na, title="S78",color=change(dtime_s3)!=0?na:lime, transp=25, linewidth=1, offset=offs_daily)
  75. plotshape(sd and dtime_s3 and dtime_s3 != dtime_s3[1] ? dtime_s3 : na, text="S78", location=location.absolute, textcolor=lime)
  76.  
  77. 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)
  78. plotshape(sd and dtime_r4 and dtime_r4 != dtime_r4[1] ? dtime_r4 : na, text="R100", location=location.absolute, textcolor=red)
  79.  
  80. 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)
  81. plotshape(sd and dtime_s4 and dtime_s4 != dtime_s4[1] ? dtime_s4 : na, text="S100", location=location.absolute, textcolor=lime)
  82.  
  83. 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)
  84. plotshape(sd and dtime_r5 and dtime_r5 != dtime_r5[1] ? dtime_r5 : na, text="R138", location=location.absolute, textcolor=red)
  85.  
  86. 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)
  87. plotshape(sd and dtime_s5 and dtime_s5 != dtime_s5[1] ? dtime_s5 : na, text="S138", location=location.absolute, textcolor=lime)
  88.  
  89. 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)
  90. plotshape(sd and dtime_r6 and dtime_r6 != dtime_r6[1] ? dtime_r6 : na, text="R161", location=location.absolute, textcolor=red)
  91.  
  92. 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)
  93. plotshape(sd and dtime_s6 and dtime_s6 != dtime_s6[1] ? dtime_s6 : na, text="S161", location=location.absolute, textcolor=lime)
  94.  
  95. 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)
  96. plotshape(sd and dtime_r7 and dtime_r7 != dtime_r7[1] ? dtime_r7 : na, text="R200", location=location.absolute, textcolor=red)
  97.  
  98. 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)
  99. 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