-
Notifications
You must be signed in to change notification settings - Fork 18
/
no-repaint-heikin-aishi.txt
22 lines (19 loc) · 1.04 KB
/
no-repaint-heikin-aishi.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//@version=5
indicator(title = "Heikin-Ashi Open Only", shorttitle = "HASO", overlay = false)
o_h = math.max(open[3], open[2], open[1])
o_l = math.min(open[3], open[2], open[1])
o_o = open[1]
o_c = open
src(_src) =>
Close = (o_h + o_l + o_o + o_c)/4
Open = (o_o + o_c) / 2
High = math.max(o_h, math.max(Open, Close))
Low = math.min(o_l, math.min(Open, Close))
HL2 = math.avg(High, Low)
HLC3 = math.avg(High, Low, Close)
OHLC4 = math.avg(Open, High, Low, Close)
Price = _src == 'close' ? Close : _src == 'open' ? Open : _src == 'high' ? High : _src == 'low' ? Low : _src == 'hl2' ? HL2 : _src == 'hlc3' ? HLC3 : OHLC4
Source = math.round(Price / syminfo.mintick) * syminfo.mintick // PineCoders method for aligning Pine prices with chart instrument prices
// === PLOTTING ===
barColor = src('close') > src('open') ? #26a69a : #ef5350 // series color
plotcandle(src('open'), src('high'), src('low'), src('close'), title = "", color = barColor, wickcolor = barColor, bordercolor = barColor) // plot bars