Advertisement
PineCoders

Chief

Feb 8th, 2020
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. //@version=4
  2. study("", "", true)
  3. gapbar_perc = input(75, minval=25, title="Gap Bar Size (%)")
  4. gapbar = tr > (atr(14) * (gapbar_perc / 100))
  5. lookback = input(5)
  6. gap_true_above = low > high[2] and gapbar and hl2 >= highest(high, lookback)[1]
  7. gap_true_below = high < low[2] and gapbar and hl2 <= lowest(low, lookback)[1]
  8. barcolor(gap_true_above ? color.orange : na, title="Bull Gap Candle")
  9. barcolor(gap_true_below ? color.black : na, title="Bear Gap Candle")
  10. // Debug
  11. plot(highest(high, lookback)[1], "", color.blue, 10, transp = 70)
  12. plot(hl2, "", color.red)
  13. plotchar(hl2 >= highest(high, lookback)[1], "hlg", "•", location.top)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement