You are on page 1of 2

//@version=4

//heikinashi
study("Heikin Ashi High and Low", overlay=false, shorttitle="Heikin Ashi HL")

ha_open = security(heikinashi(syminfo.tickerid), timeframe.period, open)


ha_high = security(heikinashi(syminfo.tickerid), timeframe.period, high)
ha_low = security(heikinashi(syminfo.tickerid), timeframe.period, low)
ha_close = security(heikinashi(syminfo.tickerid), timeframe.period, close)

plotcandle(iff(ha_open < ha_close, ha_open, na), ha_high, ha_low, ha_close,


title='Green Candles', color=#53b987, wickcolor=#53b987, bordercolor=#53b987)
plotcandle(iff(ha_open >= ha_close, ha_open, na), ha_high, ha_low, ha_close,
title='Red Candles', color=#eb4d5c, wickcolor=#eb4d5c, bordercolor=#eb4d5c)

//----------------------------------------------------------------------------//
//----Highs Group
hGroup='Highs'

//----Lows Group
lGroup='Lows'

//----Highs Color
hColorD=color.new(#3faac0, 0)

//----Lows Color
lColorD=color.new(#c0553f, 0)
//----------------------------------------------------------------------------//
//----Highs Strength
hStrength=input(title='[Strength]:',
type=input.integer,
defval=10,
minval=1,
group=hGroup)

//----Lows Strength
lStrength=input(title='[Strength]:',
type=input.integer,
defval=10,
minval=1,
group=lGroup)

//----Highs Color
hColor=input(title='[Color]:',
type=input.color,
defval=hColorD,
group=hGroup)

//----Lows Color
lColor=input(title='[Color]:',
defval=lColorD,
group=lGroup)
//----------------------------------------------------------------------------//
//----High Pivot
hPiv=pivothigh(hStrength, hStrength)

//----Low Pivot
lPiv=pivotlow(lStrength, lStrength)

//----Draw Labels
drawLabel(_offset, _pivot, _style, _yloc, _color) =>
if not na(_pivot)
label.new(bar_index[_offset], _pivot, tostring(_pivot, format.mintick),
style=_style, yloc=_yloc, color=_color, textcolor=#131722)

//----High Labels
hLabel=drawLabel(hStrength, hPiv, label.style_label_down, yloc.abovebar, hColor)

//----Low Labels
lLabel=drawLabel(lStrength, lPiv, label.style_label_up, yloc.belowbar, lColor)
//----------------------------------------------------------------------------//

You might also like