//@version=5
indicator(title="DMI/Koncorde/RSI/MACD/CMF/Stochastic", shorttitle="6en1 by Silvio",
overlay=false)
// Habilitar Indicadores
showdmi = input(true, title='DMI VISIBLE', group="Habilitar Indicadores")
showkoncorde = input(true, title='KONCORDE VISIBLE', group="Habilitar Indicadores")
showrsi = input(true, title='RSI VISIBLE', group="Habilitar Indicadores")
showmacd = input(true, title='MACD VISIBLE', group="Habilitar Indicadores")
showcmf = input(true, title='CMF VISIBLE', group="Habilitar Indicadores")
showstoch = input(true, title='STOCH VISIBLE', group="Habilitar Indicadores")
// Indicador Koncorde
deltaKon = 200
calc_mfi(length) =>
rsi_sum = math.sum(volume * (ta.change(hlc3) <= 0 ? 0 : hlc3), length)
neg_rsi_sum = math.sum(volume * (ta.change(hlc3) >= 0 ? 0 : hlc3), length)
rsi_sum / neg_rsi_sum
tprice = ohlc4
lengthEMA = 255
m = 15
pvi = ta.pvi
pvim = ta.ema(pvi, m)
pvimax = ta.highest(pvim, 90)
pvimin = ta.lowest(pvim, 90)
oscp = (pvi - pvim) * 100 / (pvimax - pvimin)
nvi = ta.nvi
nvim = ta.ema(nvi, m)
nvimax = ta.highest(nvim, 90)
nvimin = ta.lowest(nvim, 90)
azul = (nvi - nvim) * 100 / (nvimax - nvimin)
xmf = calc_mfi(14)
mult = 2.0
basis = ta.sma(tprice, 25)
dev = mult * ta.stdev(tprice, 25)
upper = basis + dev
lower = basis - dev
OB1 = (upper + lower) / 2.0
OB2 = upper - lower
BollOsc = ((tprice - OB1) / OB2 ) * 100
xrsi = ta.rsi(tprice, 14)
calc_stoch(src, length, smoothFastD) => ta.sma(100 * (src - ta.lowest(low, length)) /
(ta.highest(high, length) - ta.lowest(low, length)), smoothFastD)
stoc = calc_stoch(tprice, 21, 3)
marron = (xrsi + xmf + BollOsc + (stoc / 3)) / 2
verde = marron + oscp
media = ta.ema(marron,m)
vl=plot(showkoncorde ? verde+deltaKon : na, color=#00ff00, style=plot.style_columns,
histbase=deltaKon, linewidth=2, title="Kcd Movimiento Minorista")
ml=plot(showkoncorde ? marron+deltaKon : na, color=#ffb974, style=plot.style_columns,
histbase=deltaKon, linewidth=2, title="Kcd Montaña")
al=plot(showkoncorde ? azul+deltaKon : na, color=#00fbff, style=plot.style_columns,
histbase=deltaKon, linewidth=2, title="Kcd Movimiento Institucional")
plot(showkoncorde ? marron+deltaKon : na, color=color.rgb(116, 56, 0), linewidth=2, title="Kcd
Linea Marron")
plot(showkoncorde ? verde+deltaKon : na, color=#008c00, linewidth=2, title="Kcd Linea Verde")
plot(showkoncorde ? azul+deltaKon : na, color=#0095ff, linewidth=2, title="Kcd Linea Azul")
plot(showkoncorde ? media+deltaKon : na, color=color.rgb(255, 0, 0), linewidth=2, title="Kcd
Media Móvil")
plot(showkoncorde ? deltaKon : na, color=color.rgb(0, 0, 0), linewidth=1, title="Kcd Cero")
// Indicador MACD
deltaMacd = -250
multMacd = 15
fast_length = input.int(title="Longitud Media Rápida del MACD", defval=12, group="Indicador
MacD")
slow_length = input.int(title="Longitud Media Lenta del MACD", defval=26, group="Indicador
MacD")
src = close
signal_length = input.int(title="Longitud Suavizado MACD", minval=1, maxval=50, defval=9,
group="Indicador MacD")
sma_source = false
sma_signal = false
col_grow_above = #26A69A
col_fall_above = #B2DFDB
col_fall_below = #EF5350
col_grow_below = #FFCDD2
col_macd = #0094ff
col_signal = #ff6a00
fast_ma = sma_source ? ta.sma(src, fast_length) : ta.ema(src, fast_length)
slow_ma = sma_source ? ta.sma(src, slow_length) : ta.ema(src, slow_length)
macd = (fast_ma - slow_ma) / slow_ma * 300 * multMacd
signal = sma_signal ? ta.sma(macd, signal_length) : ta.ema(macd, signal_length)
hist = macd - signal
plot(showmacd ? hist ? hist + deltaMacd : na : na, title="MacD Histograma",
style=plot.style_columns, color=(hist>=0 ? (hist[1] < hist ? col_grow_above : col_fall_above) :
(hist[1] < hist ? col_grow_below : col_fall_below) ), histbase=deltaMacd )
plot(showmacd ? macd ? macd + deltaMacd: na : na, title="MacD", color=col_macd)
plot(showmacd ? signal ? signal + deltaMacd: na : na, title="Señal del MACD", color=col_signal)
plot(showmacd ? deltaMacd : na, color=color.rgb(0, 0, 0), linewidth=1, title="MacD Cero")
// Indicador RSI
deltaRSI = 0
multip = 2
hline(showrsi ? 0+deltaRSI : na, title="RSI Línea Cero", color=color.rgb(0, 0, 0),
linestyle=hline.style_dashed, linewidth=1)
hline(showrsi ? -70 : na, title="RSI Línea Sobreventa", color=color.green,
linestyle=hline.style_solid)
hline(showrsi ? 70 : na, color=color.red, title="RSI Línea Sobrecompra",
linestyle=hline.style_solid)
hline(showrsi ? 20 : na, title="RSI Compra", color=color.green, linestyle=hline.style_solid)
hline(showrsi ? -20 : na, color=color.red, title="RSI Venta", linestyle=hline.style_solid)
lengthRSI = input.int(14, minval=1, title="Longitud del RSI", group="Indicador RSI")
RSIMain = (ta.rsi(close, lengthRSI) - 50)
rsi_ma_length = input.int(title="RSI MA Length", defval=9, minval=1, group="Indicador RSI")
rsi_ma = ta.ema(RSIMain, rsi_ma_length)
rsiPlot = plot(showrsi ? RSIMain*multip+deltaRSI : na, title="RSI", color=color.rgb(120, 12, 139),
linewidth=2)
plot(showrsi ? rsi_ma*multip+deltaRSI : na, title="RSI MA", color=RSIMain > rsi_ma ?
color.green : color.red, linewidth=2, style=plot.style_line)
// Indicador DMI
deltaDMI = 350
multiDMI = 3
lensig = input.int(14, title="ADX Smoothing", minval=1, maxval=50, group="Indicador DMI")
len = input.int(14, minval=1, title="DI Length", group="Indicador DMI")
up = ta.change(high)
down = -ta.change(low)
plusDM = na(up) ? na : (up > down and up > 0 ? up : 0)
minusDM = na(down) ? na : (down > up and down > 0 ? down : 0)
trur = ta.rma(ta.tr, len)
plus = fixnan(100 * ta.rma(plusDM, len) / trur)
minus = fixnan(100 * ta.rma(minusDM, len) / trur)
sum = plus + minus
adx = 100 * ta.rma(math.abs(plus - minus) / (sum == 0 ? 1 : sum), lensig)
plot(showdmi ? adx*multiDMI + deltaDMI : na, color=color.rgb(0, 0, 255), title="DMI ADX")
plot(showdmi ? plus*multiDMI + deltaDMI : na, color=color.rgb(0, 255, 0), title="DMI +DI")
plot(showdmi ? minus*multiDMI + deltaDMI : na, color=color.rgb(255, 0, 0), title="DMI -DI")
// Indicador CMF
deltaCMF = -500
multiCMF = 200
var cumVol = 0.
cumVol += nz(volume)
if barstate.islast and cumVol == 0
runtime.error("No volume is provided by the data vendor.")
length = input.int(20, minval=1, group="Indicador CMF")
ad = close==high and close==low or high==low ? 0 : ((2*close-low-high)/(high-low))*volume
mf = math.sum(ad, length) / math.sum(volume, length)
hline(deltaCMF, color=color.rgb(0, 0, 0, 0), title="CMF Cero", linestyle=hline.style_dashed)
plot(showcmf ? mf*multiCMF + deltaCMF : na, color=color.rgb(0, 0, 255), title="CMF")
// Indicador Estocástico
deltaStoch = -900
multStoch = 2 // Ajustar la multiplicación para separar el estocástico
stochKLength = input.int(14, title="Longitud K", group="Indicador Estocástico")
stochDLength = input.int(3, title="Longitud D", group="Indicador Estocástico")
stochK = ta.sma(ta.stoch(close, high, low, stochKLength), stochDLength)
stochD = ta.sma(stochK, stochDLength)
// Líneas de sobrecompra y sobreventa
hline(showstoch ? 80*multStoch + deltaStoch : na, title="Línea de Sobrecompra", color=color.red,
linestyle=hline.style_solid)
hline(showstoch ? 20*multStoch + deltaStoch : na, title="Línea de Sobreventa", color=color.green,
linestyle=hline.style_solid)
plot(showstoch ? stochK*multStoch + deltaStoch : na, title="Estocástico %K", color=color.blue,
linewidth=2)
plot(showstoch ? stochD*multStoch + deltaStoch : na, title="Estocástico %D", color=color.red,
linewidth=2)