Advertisement
Guest User

Untitled

a guest
May 23rd, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.77 KB | None | 0 0
  1. //@version=3
  2.  
  3.  
  4. study(title="CM_Enhanced_Ichimoku Cloud-V5.2", shorttitle="CM_Enhanced_Ichimoku-V5.2", overlay=true)
  5. turningPeriods = input(20, minval=1, title="Tenkan-Sen")
  6. standardPeriods = input(60, minval=1, title="Kijun-Sen")
  7. specialAPeriods = input(120, minval=1, title="Kijun-Sen (auxiliary)")
  8.  
  9. leadingSpan2Periods = input(120, minval=1, title="Senkou Span B")
  10. displacement = input(30, minval=1, title="-ChikouSpan/+SenkouSpan A")
  11. sts = input(true, title="Show Tenkan-Sen")
  12. sks = input(true, title="Show Kijun-Sen")
  13. sksA = input(true, title="Show Kijun-Sen (auxiliary)")
  14. sll = input(true, title="Show Chikou Span (lagging span)?")
  15. sc = input(true, title="Show cloud")
  16. cr1 = input(true, title="Show crossings Tenkan/Kijun")
  17.  
  18. //Definitions for Tenkan-Sen (20 Period), Kijun-Sen (60 Period), Chikou Span (Lagging Line)
  19. donchian(len) => avg(lowest(len), highest(len))
  20. turning = donchian(turningPeriods)
  21. standard = donchian(standardPeriods)
  22. specialA = donchian(specialAPeriods)
  23. leadingSpan1 = avg(turning, standard)
  24. leadingSpan2 = donchian(leadingSpan2Periods)
  25.  
  26. //Crosses up/down Tenkan-Sen (20 Period) and Kijun-Sen (60 Period)
  27. crossUpTenkanKinjun = turning[1] < standard[1] and turning >= standard ? 1 : 0
  28. crossDnTenkanKinjun = turning[1] > standard[1] and turning <= standard ? 1 : 0
  29. leadingSpan1Above = leadingSpan1 >= leadingSpan2 ? 1 : na
  30. leadingSpan2Below = leadingSpan1 <= leadingSpan2 ? 1 : na
  31. span1plotU = leadingSpan1Above ? leadingSpan1 : na
  32. span2plotU = leadingSpan1Above ? leadingSpan2 : na
  33. span1plotD = leadingSpan2Below ? leadingSpan1 : na
  34. span2plotD = leadingSpan2Below ? leadingSpan2 : na
  35. col = leadingSpan1 >= leadingSpan2 ? #7D71FC : #E68F8F // bullish, bearish
  36.  
  37. //Cloud Lines Plot Statements - ***Regular Lines to Fill in Break in Gap
  38. plot(sc and leadingSpan1 ? leadingSpan1 : na, title = 'Senkou Span A cloud', style=line, linewidth=1, offset = displacement, color=col)
  39. plot(sc and leadingSpan2 ? leadingSpan2 : na, title = 'Senkou Span B cloud', style=line, linewidth=3, offset = displacement, color=col)
  40.  
  41. //Cloud Lines Plot Statements - ***linebr to create rules for change in Shading
  42. p1 = plot(sc and span1plotU ? span1plotU : na, title = 'Senkou Span A above Span B Cloud', style=linebr, linewidth=1, offset = displacement, color=col)
  43. p2 = plot(sc and span2plotU ? span2plotU : na, title = 'Senkou Span B below Span A Cloud', style=linebr, linewidth=1, offset = displacement, color=col)
  44. p3 = plot(sc and span1plotD ? span1plotD : na, title = 'Senkou Span A below Span B Cloud', style=linebr, linewidth=1, offset = displacement, color=col)
  45. p4 = plot(sc and span2plotD ? span2plotD : na, title = 'Senkou Span B above Span A Cloud', style=linebr, linewidth=1, offset = displacement, color=col)
  46.  
  47. //Fills that color cloud based on Trend.
  48. fill(p1, p2, color=#361CCA ,title='Kumo (Cloud)') // bullish cloud
  49. fill(p3, p4, color=#CA1C59, title='Kumo (Cloud)') // bearish cloud
  50.  
  51. //plots for 3 lines other than cloud.
  52. plot(sts and turning ? turning : na, title = 'Tenkan-Sen', linewidth=2, color=orange, transp=0)
  53. plot(sks and standard ? standard : na, title = 'Kijun-Sen', linewidth=3, color=blue, transp=0)
  54. plot(sksA and specialA ? specialA : na, title = 'Kijun-Sen auxiliary I', linewidth=2, color=black, transp=0)
  55.  
  56. plot(sll and close ? close : na, title='Chikou Span (Lagging Span)', linewidth=2, offset = -displacement, color=#A900FF)
  57.  
  58. //Arrow Plots At Tenkan-Sen (20 Period) and Kinjun-Sen (60 Period)
  59. plotchar(cr1 and crossUpTenkanKinjun ? leadingSpan1 : na, title="CrossUp Tenkan Kijun Entry Arrow",char='▲', color=black, transp=0, location=location.absolute, size=size.small)
  60. plotchar(cr1 and crossDnTenkanKinjun ? leadingSpan1 : na, title="CrossUp Tenkan Kijun Entry Arrow",char='▼', color=black, transp=0, location=location.absolute, size=size.small)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement