OPEN-SOURCE SCRIPT

YAMIL

//version=6
indicator(title = 'MACD+RSI+KONCORDE YAMIL', shorttitle = 'MAC+RSI+KON YAMIL')

//KONCORDE
showkoncorde = input(true, title = 'Koncorde')
deltaKon = input(-700, title = 'KONCORDE - Desfase')
escalaKoncorde = input(2, 'Koncorde - Escala')

calc_mfi(length) =>
100.0 - 100.0 / (1.0 + math.sum(volume * (ta.change(hlc3) <= 0 ? 0 : hlc3), length) / math.sum(volume * (ta.change(hlc3) >= 0 ? 0 : hlc3), length))

tprice = ohlc4
lengthEMA = 255
m = 15
pvim = ta.ema(ta.pvi, m)
pvimax = ta.highest(pvim, 90)
pvimin = ta.lowest(pvim, 90)
oscp = (ta.pvi - pvim) * 100 / (pvimax - pvimin)
nvim = ta.ema(ta.nvi, m)
nvimax = ta.highest(nvim, 90)
nvimin = ta.lowest(nvim, 90)
azul = (ta.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, 21) //

vl = plot(showkoncorde ? verde * escalaKoncorde + deltaKon : na, color = color.new(#25BC00, 0), style = plot.style_columns, histbase = deltaKon, linewidth = 4, title = 'Manos Chicas')
ml = plot(showkoncorde ? marron * escalaKoncorde + deltaKon : na, color = color.new(#FFC34C, 0), style = plot.style_columns, histbase = deltaKon, linewidth = 4, title = 'Koncorde - marron')
al = plot(showkoncorde ? azul * escalaKoncorde + deltaKon : na, color = color.new(#6C3AFF, 0), style = plot.style_columns, histbase = deltaKon, linewidth = 4, title = 'Manos Grandes')
plot(showkoncorde ? marron * escalaKoncorde + deltaKon : na, color = color.new(#000000, 0), linewidth = 1, title = 'Koncorde - lmarron')
plot(showkoncorde ? media * escalaKoncorde + deltaKon : na, color = color.new(#FF0000, 0), linewidth = 1, title = 'Koncorde - media')
hline(-700, color = color.black, linestyle = hline.style_solid)


// MACD
// Getting inputs
showmacd = input(true, title = 'MADC')
deltaMacd = input(700, title = 'MACD - Desfase')
multMacd = input(5, title = 'MACD - Escala')
fast_length = input(title = 'MACD - Fast Length', defval = 12)
slow_length = input(title = 'MACD - Slow Length', defval = 26)
src = input(title = 'MACD - Source', defval = close)
signal_length = input.int(title = 'MACD - Signal Smoothing', minval = 1, maxval = 50, defval = 9)
sma_source = input(title = 'MACD - Simple MA(Oscillator)', defval = false)
sma_signal = input(title = 'MACD - Simple MA(Signal Line)', defval = false)

// Plot colors
col_grow_above = #2AFF00
col_grow_below = #FF0000
col_fall_above = #168500
col_fall_below = #980000
col_macd = #0042FF
col_signal = #FFA200

// Calculating
//[outMacD, outSignal, outHist] = macd(close, fastLength, slowLength, signalLength)
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 * 1000 * multMacd
signal = sma_signal ? ta.sma(macd, signal_length) : ta.ema(macd, signal_length)
hist = macd - signal


plot(showmacd ? bool(hist) ? hist + deltaMacd : na : na, title = 'MACD - Histogram', 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 ? bool(macd) ? macd + deltaMacd : na : na, title = 'MACD', color = color.new(col_macd, 0), linewidth = 1)
plot(showmacd ? bool(signal) ? signal + deltaMacd : na : na, title = 'MACD - Signal', color = color.new(col_signal, 0), linewidth = 1)

hline(700, color = color.black, linestyle = hline.style_solid, linewidth = 1)


// STOCH (14,3,1)
showrsi = input(true, title = 'RSI - STOCH')
deltaRSI = input(0, title = 'RSI/STOCH - Desfase')
multip = input(5, title = 'RSI/STOCH - Escala')
deltaSTOCH = deltaRSI - 50 * multip / 2
length = input.int(14, minval = 1, title = 'STOCH - Periodo')
smoothK = input.int(1, minval = 1, title = 'STOCH - Smooth K')
smoothD = input.int(3, minval = 1, title = 'STOCH - Smooth D')
k = ta.sma(ta.stoch(close, high, low, length), smoothK)
d = ta.sma(k, smoothD)

// RSI

bandm = hline(showrsi ? 0 + deltaRSI : na, color = color.black, linewidth = 1, linestyle = hline.style_solid)
band0 = hline(showrsi ? -20 * multip + deltaRSI : na, color = color.new(#59FF00, 0), linewidth = 1, linestyle = hline.style_dotted)
band1 = hline(showrsi ? 20 * multip + deltaRSI : na, color = color.new(#FF0000, 0), linewidth = 1, linestyle = hline.style_dotted)
fill(band1, band0, color = color.new(#FFFF00, 75), title = 'Background')
lengthRSI = input.int(14, minval = 1, title = 'RSI - Periodo')
RSIMain = ta.rsi(close, lengthRSI) - 50
rsiPlot = plot(showrsi ? RSIMain * multip + deltaRSI : na, color = color.new(#000000, 0), linewidth = 1)

// Media móvil en RSI
lengthMA = input.int(21, minval = 1, title = 'RSI - Media Móvil Ponderada Periodo')
RSIMA = ta.wma(RSIMain * multip + deltaRSI, lengthMA)
plot(showrsi ? RSIMA : na, color = color.new(#78FF00, 0), linewidth = 1, title = 'RSI - Media Móvil')


// STOCH (14,3,1) en RSI
showstoch = input(true, title = 'STOCH - RSI')
deltaSTOCH_RSI = input(100, title = 'STOCH - RSI Desfase')
kRSI = ta.sma(ta.stoch(RSIMain, RSIMain, RSIMain, length), smoothK)
dRSI = ta.sma(kRSI, smoothD)
plot(false ? bool(kRSI) ? kRSI + deltaSTOCH_RSI : na : na, title = 'STOCH - RSI K', color = color.new(#0000FF, 0), linewidth = 1)
plot(false ? bool(dRSI) ? dRSI + deltaSTOCH_RSI : na : na, title = 'STOCH - RSI D', color = color.new(#FFA500, 0), linewidth = 1)

Feragatname