Professional Documents
Culture Documents
Code 2
Code 2
//heikinashi
study("Heikin Ashi High and Low", overlay=false, shorttitle="Heikin Ashi HL")
//----------------------------------------------------------------------------//
//----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)
//----------------------------------------------------------------------------//