instrument { name = "Wanderson Pro Max Break 50", overlay = true, icon =
"indicators:MA" }
---------------------------------------------------
-- INPUTS
---------------------------------------------------
input_group {
"Perodos das EMAs",
ema9_per = input(9, "EMA 9", [Link], 1),
ema20_per = input(20, "EMA 20", [Link], 1),
ema50_per = input(50, "EMA 50 (High)", [Link], 1),
ema13_per = input(13, "EMA 13 (Rpida)", [Link], 1)
}
input_group {
"ZigZag",
zig_percent = input(0.8, "Percentual ZigZag (%)", [Link], 0.1, 50)
}
input_group {
"Cores",
comprar_color = input { default = "green", type = [Link] },
vender_color = input { default = "red", type = [Link] },
ema9_color = input { default = "yellow", type = [Link] },
ema20_color = input { default = "purple", type = [Link] },
ema13_color = input { default = "cyan", type = [Link] },
ema50_color = input { default = "orange", type = [Link] }
}
---------------------------------------------------
-- CLCULO DAS EMAs
---------------------------------------------------
ema9 = ema(close, ema9_per)
ema20 = ema(close, ema20_per)
ema13 = ema(close, ema13_per)
ema50 = ema(high, ema50_per)
plot(ema9, "EMA 9", ema9_color, 2)
plot(ema20,"EMA 20",ema20_color,2)
plot(ema13,"EMA13", ema13_color,2)
plot(ema50,"EMA50", ema50_color,2)
---------------------------------------------------
-- ZIGZAG
---------------------------------------------------
percent = zig_percent / 100
if not zz_prev then
zz_prev = close
end
if close > zz_prev * (1 + percent) then
zig = close
zz_prev = close
zig_color = comprar_color
elseif close < zz_prev * (1 - percent) then
zig = close
zz_prev = close
zig_color = vender_color
else
zig = zig or close
zig_color = "gray"
end
plot(zig, "ZigZag", zig_color, 2)
---------------------------------------------------
-- FILTRO DE TENDNCIA (EMA50)
---------------------------------------------------
tendencia_alta = ema13 > ema20 and ema20 > ema50
tendencia_baixa = ema13 < ema20 and ema20 < ema50
---------------------------------------------------
-- ROMPIMENTO DA EMA50 (SINAL FORTE)
---------------------------------------------------
rompeu_cima = close > ema50 and open < ema50
rompeu_baixo = close < ema50 and open > ema50
---------------------------------------------------
-- FINAL: SINAIS FORTES
---------------------------------------------------
buy_signal = tendencia_alta and rompeu_cima
sell_signal = tendencia_baixa and rompeu_baixo
---------------------------------------------------
-- ALERTAS VISUAIS
---------------------------------------------------
plot_shape(
buy_signal,
"BUY Forte",
shape_style.triangleup,
shape_size.large,
comprar_color,
shape_location.belowbar,
0,
"BUY (FORTE)",
"white"
)
plot_shape(
sell_signal,
"SELL Forte",
shape_style.triangledown,
shape_size.large,
vender_color,
shape_location.abovebar,
0,
"SELL (FORTE)",
"white"
)
---------------------------------------------------
-- ALERTA SONORO
---------------------------------------------------
if buy_signal then
alert("SINAL FORTE DE COMPRA ROMPEU EMA50", alert.freq_once_per_bar)
end
if sell_signal then
alert("SINAL FORTE DE VENDA ROMPEU EMA50", alert.freq_once_per_bar)
end