0% found this document useful (0 votes)
67 views3 pages

Trading Values

This document defines an indicator script called "Script Bandera". It includes inputs for periods, colors, and other parameters. The script calculates technical indicators like EMA, MACD, RSI, and MSI and plots the results on a chart along with buy/sell signals and trend lines.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
67 views3 pages

Trading Values

This document defines an indicator script called "Script Bandera". It includes inputs for periods, colors, and other parameters. The script calculates technical indicators like EMA, MACD, RSI, and MSI and plots the results on a chart along with buy/sell signals and trend lines.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

instrument {overlay = true,

name = 'Script Bandera',


overlay= true }

input_group {
"Compra",
comprar_color = input {default = "green", type = input.color}
}

input_group {
"Periodo Max/Min",
doch_time = input {default = "30", type = input.string}
}

input_group {
"Periodo da Micro Tendencia",
emaa_per = input {default = "21", type = input.string}
}

input_group {
"Periodo da Macro Tendencia",
emab_per = input {default = "200", type = input.string}
}

input_group {
"Media Rapida",
emac_per = input {default = "7", type = input.string}
}

input_group {
"Media Lenta",
emad_per = input {default = "17", type = input.string}
}

input_group {
"Venda",
vender_color = input {default = "red", type = input.color}
}

input_group {
"Resistencia",
upline_color = input {default = "red", type = input.color}
}

input_group {
"Suporte",
lowline_color = input {default = "green", type = input.color}
}

input_group {
"Candles",
positivo = input { default = "green", type = input.color },
neutro = input { default = "white", type = input.color },
negativo = input { default = "red", type = input.color },
}

-- PARAMETERS
EMAA = ema(close, emaa_per)
EMAB = ema(close, emab_per)
EMAC = ema(hlc3, emac_per)
EMAD = ema(hlc3, emad_per)
upper = highest(high, doch_time)
lower = lowest(low, doch_time)

-- CALCULATIONS
TA = (close > close[1]) and (close > EMAA) and (EMAA > EMAA[1])
TB = (close < close[1]) and (close < EMAA) and (EMAA < EMAA[1])
ENC = (EMAC[1] < EMAD[1]) and (EMAC > EMAD)
ENV = (EMAC[1] > EMAD[1]) and (EMAC < EMAD)

-- MACD
macdResults = macd(close, 12, 26, 9)
macdLine = macdResults[1]
signalLine = macdResults[2]
histogram = macdResults[3]

macdHistColor = macdLine - signalLine >= 0 and positivo or negativo

-- RSI
rsiValue = rsi(close, 14)
if rsiValue >= 70 then
rsiColor = negativo
elseif rsiValue <= 30 then
rsiColor = positivo
else
rsiColor = neutro
end

-- MSI
exp1 = ema(tr, 9)
exp2 = ema(exp1, 9)
msiValue = exp1 / exp2
if msiValue >= 27 then
msiColor = positivo
elseif msiValue <= 26 then
msiColor = negativo
else
msiColor = neutro
end

sec = security(current_ticker_id, "1m")


if sec then
local bar_color

if TA then
bar_color = positivo
elseif TB then
bar_color = negativo
else
bar_color = neutro
end

plot_candle(open, high, low, close, "ES", bar_color)


plot(upper, "Resistencia", upline_color)
plot(lower, "Suporte", lowline_color)
-- NEGOCIAO
plot_shape(ENV, "VENDER", shape_style.flag, shape_size.huge, vender_color,
shape_location.abovebar, 0, "PUT", vender_color)
plot_shape(ENC, "COMPRAR", shape_style.flag, shape_size.huge, comprar_color,
shape_location.belowbar, 0, "CALL", comprar_color)

-- PLOT MACD HISTOGRAM


plot(macdHistColor, "MACD Histogram", macdHistColor)

-- PLOT RSI
if rsiValue >= 70 then
bgcolor(negativo, 80)
elseif rsiValue <= 30 then
bgcolor(positivo, 80)
else
bgcolor(neutro, 80)
end

-- PLOT MSI
if msiValue >= 27 then
bgcolor(positivo, 80)
elseif msiValue <= 26 then
bgcolor(negativo, 80)
else
bgcolor(neutro, 80)
end

end

You might also like