xmd79

Silver Bullet ICT time range

May 24th, 2023
361
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.74 KB | None | 0 0
  1.  
  2. //@version=5
  3.  
  4. indicator("Silver Bullet ICT time range", overlay=true)
  5.  
  6. bgColor = input.bool(false, "Activate High/Low View")
  7.  
  8. LondonColor = color.new(color.green, 90)
  9. NYColor = color.new(color.red, 90)
  10. AsiaColor = color.new(color.yellow, 90)
  11.  
  12.  
  13. ///Sessions
  14.  
  15. res = input.timeframe("D", "Resolution", ["D","W","M"])
  16. london = input.session("0300-0400:1234567", "London Session")
  17. ny = input.session("1000-1100:1234567", "New York AM")
  18. tokyo = input.session("1400-1500:1234567", "New York PM")
  19.  
  20.  
  21. //Bars
  22.  
  23. is_newbar(sess) =>
  24. t = time(res, sess, "America/New_York")
  25. na(t[1]) and not na(t) or t[1] < t
  26.  
  27. is_session(sess) =>
  28. not na(time(timeframe.period, sess, "America/New_York"))
  29.  
  30.  
  31. //London
  32.  
  33. London = input.bool(true, "London Session")
  34.  
  35. londonNewbar = is_newbar(london)
  36. londonSession = is_session(london)
  37.  
  38. float londonLow = na
  39. londonLow := if londonSession
  40. if londonNewbar
  41. low
  42. else
  43. math.min(londonLow[1],low)
  44. else
  45. londonLow
  46.  
  47. float londonHigh = na
  48. londonHigh := if londonSession
  49. if londonNewbar
  50. high
  51. else
  52. math.max(londonHigh[1],high)
  53. else
  54. londonHigh
  55.  
  56.  
  57. plotLL = plot(londonLow, color=color.new(#000000, 100))
  58. plotLH = plot(londonHigh, color=color.new(#000000, 100))
  59. fill(plotLL, plotLH, color = londonSession and London and bgColor ? LondonColor : na)
  60.  
  61. bgcolor(londonSession and London and not bgColor ? LondonColor : na)
  62.  
  63.  
  64.  
  65. //New York
  66.  
  67. NY = input.bool(true, "New York Session AM")
  68.  
  69. nyNewbar = is_newbar(ny)
  70. nySession = is_session(ny)
  71.  
  72. float nyLow = na
  73. nyLow := if nySession
  74. if nyNewbar
  75. low
  76. else
  77. math.min(nyLow[1],low)
  78. else
  79. nyLow
  80.  
  81. float nyHigh = na
  82. nyHigh := if nySession
  83. if nyNewbar
  84. high
  85. else
  86. math.max(nyHigh[1],high)
  87. else
  88. nyHigh
  89.  
  90.  
  91. plotNYL = plot(nyLow, color=color.new(#000000, 100))
  92. plotNYH = plot(nyHigh, color=color.new(#000000, 100))
  93. fill(plotNYL, plotNYH, color = nySession and NY and bgColor ? NYColor : na)
  94.  
  95. bgcolor(nySession and NY and not bgColor ? NYColor : na)
  96.  
  97.  
  98. //Tokyo
  99.  
  100. Tokyo = input.bool(true, "New York Session PM")
  101.  
  102. tokyoNewbar = is_newbar(tokyo)
  103. tokyoSession = is_session(tokyo)
  104.  
  105. float tokyoLow = na
  106. tokyoLow := if tokyoSession
  107. if tokyoNewbar
  108. low
  109. else
  110. math.min(tokyoLow[1],low)
  111. else
  112. tokyoLow
  113.  
  114. float tokyoHigh = na
  115. tokyoHigh := if tokyoSession
  116. if tokyoNewbar
  117. high
  118. else
  119. math.max(tokyoHigh[1],high)
  120. else
  121. tokyoHigh
  122.  
  123.  
  124. plotTL = plot(tokyoLow, color=color.new(#000000, 100))
  125. plotTH = plot(tokyoHigh, color=color.new(#000000, 100))
  126. fill(plotTL, plotTH, color = tokyoSession and Tokyo and bgColor ? AsiaColor : na)
  127.  
  128. bgcolor(tokyoSession and Tokyo and not bgColor ? AsiaColor : na)
  129.  
  130.  
  131.  
  132. //Sydney
  133.  
  134.  
Advertisement
Add Comment
Please, Sign In to add comment