FXSurf

FXSurf Monthly Fib Pivots

Nov 12th, 2020
432
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 Monthly Pivots 2.0", shorttitle="FXSurf Monthly Pivots 2.0", overlay=true)
  3. sd = input(true, title="Show Monthly 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, "M", 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, "M", pivot[1])
  33. dtime_r7 = security(tickerid, "M", R7[1])
  34. dtime_r6 = security(tickerid, "M", R6[1])
  35. dtime_r5 = security(tickerid, "M", R5[1])
  36. dtime_r4 = security(tickerid, "M", R4[1])
  37. dtime_r3 = security(tickerid, "M", R3[1])
  38. dtime_r2 = security(tickerid, "M", R2[1])
  39. dtime_r1 = security(tickerid, "M", R1[1])
  40. dtime_s1 = security(tickerid, "M", S1[1])
  41. dtime_s2 = security(tickerid, "M", S2[1])
  42. dtime_s3 = security(tickerid, "M", S3[1])
  43. dtime_s4 = security(tickerid, "M", S4[1])
  44. dtime_s5 = security(tickerid, "M", S5[1])
  45. dtime_s6 = security(tickerid, "M", S6[1])
  46. dtime_s7 = security(tickerid, "M", S7[1])
  47.  
  48.  
  49. //PLotting
  50. offs_daily = 0
  51. plot(sd and dtime_pivot ? dtime_pivot : na, title="MP",color=change(dtime_pivot)!=0?na:yellow, transp=25, linewidth=2, offset=offs_daily)
  52. plotshape(sd and dtime_pivot and dtime_pivot != dtime_pivot[1] ? dtime_pivot : na, text="MP", location=location.absolute, textcolor=yellow)
  53.  
  54. plot(sd and dtime_r1 ? dtime_r1 : na, title="R38",color=change(dtime_r1)!=0?na:red, transp=25, linewidth=2, offset=offs_daily)
  55. plotshape(sd and dtime_r1 and dtime_r1 != dtime_r1[1] ? dtime_r1 : na, text="R38", location=location.absolute, textcolor=red)
  56.  
  57. plot(sd and dtime_s1 ? dtime_s1 : na, title="S38",color=change(dtime_s1)!=0?na:lime, transp=25, linewidth=2, offset=offs_daily)
  58. plotshape(sd and dtime_s1 and dtime_s1 != dtime_s1[1] ? dtime_s1 : na, text="S38", location=location.absolute, textcolor=lime)
  59.  
  60.  
  61. plot(sd and dtime_r2 ? dtime_r2 : na, title="R61",color=change(dtime_r2)!=0?na:red, transp=25, linewidth=2, offset=offs_daily)
  62. plotshape(sd and dtime_r2 and dtime_r2 != dtime_r2[1] ? dtime_r2 : na, text="R61", location=location.absolute, textcolor=red)
  63.  
  64.  
  65. plot(sd and dtime_s2 ? dtime_s2 : na, title="S61",color=change(dtime_s1)!=0?na:lime, transp=25, linewidth=2, offset=offs_daily)
  66. plotshape(sd and dtime_s2 and dtime_s2 != dtime_s2[1] ? dtime_s2 : na, text="S61", location=location.absolute, textcolor=lime)
  67.  
  68.  
  69. plot(sd and dtime_r3 ? dtime_r3 : na, title="R78",color=change(dtime_r3)!=0?na:red, transp=25, linewidth=2, offset=offs_daily)
  70. plotshape(sd and dtime_r3 and dtime_r3 != dtime_r3[1] ? dtime_r3 : na, text="R78", location=location.absolute, textcolor=red)
  71.  
  72.  
  73. plot(sd and dtime_s3 ? dtime_s3 : na, title="S78",color=change(dtime_s3)!=0?na:lime, transp=25, linewidth=2, offset=offs_daily)
  74. plotshape(sd and dtime_s3 and dtime_s3 != dtime_s3[1] ? dtime_s3 : na, text="S78", location=location.absolute, textcolor=lime)
  75.  
  76. plot(sd and dtime_r4 and sal? dtime_r4 : na, title="R100",color=change(dtime_r4)!=0?na:red, transp=25, linewidth=2, offset=offs_daily)
  77. plotshape(sd and dtime_r4 and dtime_r4 != dtime_r4[1] ? dtime_r4 : na, text="R100", location=location.absolute, textcolor=red)
  78.  
  79. plot(sd and dtime_s4 and sal? dtime_s4 : na, title="S100",color=change(dtime_s4)!=0?na:lime, transp=25, linewidth=2, offset=offs_daily)
  80. plotshape(sd and dtime_s4 and dtime_s4 != dtime_s4[1] ? dtime_s4 : na, text="S100", location=location.absolute, textcolor=lime)
  81.  
  82. plot(sd and dtime_r5 and sal? dtime_r5 : na, title="R138 R5",color=change(dtime_r5)!=0?na:red, transp=25, linewidth=2, offset=offs_daily)
  83. plotshape(sd and dtime_r5 and dtime_r5 != dtime_r5[1] ? dtime_r5 : na, text="R138", location=location.absolute, textcolor=red)
  84.  
  85. plot(sd and dtime_s5 and sal? dtime_s5 : na, title="S138 S5",color=change(dtime_s5)!=0?na:lime, transp=25, linewidth=2, offset=offs_daily)
  86. plotshape(sd and dtime_s5 and dtime_s5 != dtime_s5[1] ? dtime_s5 : na, text="S138", location=location.absolute, textcolor=lime)
  87.  
  88. plot(sd and dtime_r6 and sal? dtime_r6 : na, title="R161",color=change(dtime_r6)!=0?na:red, transp=25, linewidth=2, offset=offs_daily)
  89. plotshape(sd and dtime_r6 and dtime_r6 != dtime_r6[1] ? dtime_r6 : na, text="R161", location=location.absolute, textcolor=red)
  90.  
  91. plot(sd and dtime_s6 and sal? dtime_s6 : na, title="S161",color=change(dtime_s6)!=0?na:lime, transp=25, linewidth=2, offset=offs_daily)
  92. plotshape(sd and dtime_s6 and dtime_s6 != dtime_s6[1] ? dtime_s6 : na, text="S161", location=location.absolute, textcolor=lime)
  93.  
  94. plot(sd and dtime_r7 and sal? dtime_r7 : na, title="R200",color=change(dtime_r7)!=0?na:red, transp=25, linewidth=2, offset=offs_daily)
  95. plotshape(sd and dtime_r7 and dtime_r7 != dtime_r7[1] ? dtime_r7 : na, text="R200", location=location.absolute, textcolor=red)
  96.  
  97. plot(sd and dtime_s7 and sal? dtime_s7 : na, title="S200",color=change(dtime_s7)!=0?na:lime, transp=25, linewidth=2, offset=offs_daily)
  98. 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