Script Premium in English

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

instrument {overlay = true,

name = 'Flag Script',


overlay = true}

input_group {
"Buy",
buy_color = input {default = "green", type = input.color}
}

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

input_group {
"Micro Trend Period",
emaa_per = input {default = "21", type = input.string}
}

input_group {
"Macro Trend Period",
emab_per = input {default = "200", type = input.string}
}

input_group {
"Fast Moving Average",
emac_per = input {default = "7", type = input.string}
}

input_group {
"Slow Moving Average",
emad_per = input {default = "17", type = input.string}
}

input_group {
"Sell",
sell_color = input {default = "red", type = input.color}
}

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

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

input_group {
"Candles",
positive = input {default = "green", type = input.color},
neutral = input {default = "white", type = input.color},
negative = 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))

sec = security(current_ticker_id, "1m")


if sec then

local bar_color

if (TA == true) then


bar_color = positive
elseif (TB == true) then
bar_color = negative
else
bar_color = neutral
end

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


plot(upper, "Resistance", upline_color)
plot(lower, "Support", lowline_color)

--TRADING

plot_shape((ENV),
"SELL",
shape_style.flag,
shape_size.huge,
sell_color,
shape_location.abovebar,
0,
"PUT",
sell_color)

plot_shape((ENC),
"BUY",
shape_style.flag,
shape_size.huge,
buy_color,
shape_location.belowbar,
0,
"CALL",
buy_color)

end

You might also like