-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathARI-WGAP.pine
29 lines (24 loc) · 919 Bytes
/
ARI-WGAP.pine
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
//@version=4
study(title="ARI wrong gap finder", shorttitle="ARI WGAP", overlay=true)
// clear_past = input(title="Clear filled gaps", type=input.bool, defval=true)
bars = input(3, "Max bars")
if bars <= 3
bars := 3
perc = input(1, "Min gap % allowed")
if perc <= 0
perc := 1
// scenario one: bearish
// a = low[2]
a = lowest(low[2],bars-2)
b = high
delta_bear = (a-b)
gap_bear = delta_bear/b > (perc/100) ? (a>b) : na
if gap_bear
bx = box.new(bar_index[bars-1], low[2], bar_index[0], high, color.green, 1, line.style_solid, extend.none, xloc.bar_index, color.new(color.green, 90))
// scenario two: bullish
a_bull = highest(high[2],bars-2)
b_bull = low
delta_bull = (b_bull-a_bull)
gap_bull = delta_bull/a > (perc/100) ? (a<b) : na
if gap_bull
bx = box.new(bar_index[bars-1], high[2], bar_index[0], low, color.purple, 1, line.style_solid, extend.none, xloc.bar_index, color.new(color.purple, 90))