0% found this document useful (0 votes)
363 views2 pages

Ultimate Trading Script

This document defines an indicator script with inputs for time periods, colors, and calculations. It contains calculations for a 9 period and 21 period EMA, as well as MACD signals. It plots candlesticks with color determined by signals, along with resistance, support, and buy/sell flags based on the indicators.
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)
363 views2 pages

Ultimate Trading Script

This document defines an indicator script with inputs for time periods, colors, and calculations. It contains calculations for a 9 period and 21 period EMA, as well as MACD signals. It plots candlesticks with color determined by signals, along with resistance, support, and buy/sell flags based on the indicators.
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/ 2

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.integer}
}

input_group {
"Periodo da Micro Tendencia",
emaa_per = input {default = 9, type = input.integer}
}

input_group {
"Periodo da Macro Tendencia",
emab_per = input {default = 21, type = input.integer}
}

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

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

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}
}

--PARAMETROS
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)
--CALCULOS
TA = crossover(EMAA, EMAB) and crossover(EMAC, EMAD) -- Buy when 9 EMA crosses
above 21 EMA and MACD Fast EMA crosses above Slow EMA
TB = crossunder(EMAA, EMAB) and crossunder(EMAC, EMAD) -- Sell when 9 EMA crosses
below 21 EMA and MACD Fast EMA crosses below Slow EMA
ENC = (EMAC > EMAD) and (EMAC[1] <= EMAD[1])
ENV = (EMAC < EMAD) and (EMAC[1] >= EMAD[1])

sec = security(current_ticker_id, "1m")


if sec then
local bar_color

if (TA == true) then


bar_color = close > open and comprar_color or negativo
elseif (TB == true) then
bar_color = close > open and positivo or vender_color
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)
end

You might also like