Heatmap Volume (Xdecow)
Heatmap Volume (Xdecow)
//------------------------------------------------------------------------------
// Inputs
//------------------------------------------------------------------------------
// Colors
// config
g_color = 'Color settings'
bcolor_enabled = input(true, 'Colored bars', group = g_color)
zmode = input.string('Backgrounds', 'Display Heatmap Zones as', options=['None',
'Lines', 'Backgrounds', 'Both'], group = g_color)
cmode = input.string('Heatmap', 'Color Mode', options=['Heatmap', 'Up/Down'], group
= g_color, tooltip = '- Heatmap mode: colors based only on volume.\n- Up/Down mode:
colors based on candle volume and direction.\nChange the cores below according to
the selected mode.')
// heatmap colors
chm1 = #ff0000 // extra high red
chm2 = #ff7800 // high orange
chm3 = #ffcf03 // medium yellow
chm4 = #a0d6dc // normal
chm5 = #1f9cac // low
// heatmap colors
g_mhcolor = 'Heatmap colors'
chmthresholdExtraHigh = input(chm1, 'Extra High', group=g_mhcolor)
chmthresholdHigh = input(chm2, 'High', group=g_mhcolor)
chmthresholdMedium = input(chm3, 'Medium', group=g_mhcolor)
chmthresholdNormal = input(chm4, 'Normal', group=g_mhcolor)
chmthresholdLow = input(chm5, 'Low', group=g_mhcolor)
// up colors
g_up = 'Up colors'
cupthresholdExtraHigh = input(#00FF00, 'Extra High', group = g_up)
cupthresholdHigh = input(#30FF30, 'High', group = g_up)
cupthresholdMedium = input(#60FF60, 'Medium', group = g_up)
cupthresholdNormal = input(#8FFF8F, 'Normal', group = g_up)
cupthresholdLow = input(#BFFFBF, 'Low', group = g_up)
// down colors
g_down = 'Down colors'
cdnthresholdExtraHigh = input(#FF0000, 'Extra High', group = g_down)
cdnthresholdHigh = input(#FF3030, 'High', group = g_down)
cdnthresholdMedium = input(#FF6060, 'Medium', group = g_down)
cdnthresholdNormal = input(#FF8F8F, 'Normal', group = g_down)
cdnthresholdLow = input(#FFBFBF, 'Low', group = g_down)
// threshold colors
cthresholdExtraHighUp = cmode == 'Heatmap' ? chmthresholdExtraHigh :
cupthresholdExtraHigh
cthresholdHighUp = cmode == 'Heatmap' ? chmthresholdHigh : cupthresholdHigh
cthresholdMediumUp = cmode == 'Heatmap' ? chmthresholdMedium : cupthresholdMedium
cthresholdNormalUp = cmode == 'Heatmap' ? chmthresholdNormal : cupthresholdNormal
cthresholdLowUp = cmode == 'Heatmap' ? chmthresholdLow : cupthresholdLow
//------------------------------------------------------------------------------
// Calcs
// heatmap lines
zshow_lines = zmode == 'Lines' or zmode == 'Both'
zshow_backgrounds = zmode == 'Backgrounds' or zmode == 'Both'
//------------------------------------------------------------------------------
// Plots
// heatmap fills
tpf = 85
fill(pt, p1, color.new(chm1, tpf), title='Extra High heatmap zone')
fill(p1, p2, color.new(chm2, tpf), title='High heatmap zone')
fill(p2, p3, color.new(chm3, tpf), title='Medium heatmap zone')
fill(p3, p4, color.new(chm4, tpf), title='Normal heatmap zone')
fill(p4, p0, color.new(chm5,tpf), title='Low heatmap zone')
// volume
plot(volume, color=bcolor, style=plot.style_columns, title='Volume',
editable=false)
// moving average
plot(mean, color=color.new(#000000, 0), linewidth=2, title='Moving Average',
style=plot.style_line, display=display.none)
// heatmap lines
tpp = 50
plot(zshow_lines ? ts1 : na, color=color.new(chm1, tpp), title='Extra High heatmap
line')
plot(zshow_lines ? ts2 : na, color=color.new(chm2, tpp), title='High heatmap line')
plot(zshow_lines ? ts3 : na, color=color.new(chm3, tpp), title='Medium heatmap
line')
plot(zshow_lines ? ts4 : na, color=color.new(chm4, tpp), title='Normal heatmap
line')
//------------------------------------------------------------------------------
// Alerts