//@version=5 indicator("Million Moves com Confirmação", overlay=true) // Parâmetros do…
- User
//@version=5 indicator("Million Moves com Confirmação", overlay=true)
// Parâmetros do indicador length = input.int(14, title="Comprimento") src = input(close, title="Fonte") stopLossPercent = input.float(0.5, title="StopLoss (%)") / 100 tp1Percent = input.float(1.0, title="TP1 (%)") / 100 tp2Percent = input.float(1.5, title="TP2 (%)") / 100 tp3Percent = input.float(2.0, title="TP3 (%)") / 100
// Média Móvel Simples sma = ta.sma(src, length)
// Sinais de Compra e Venda buySignal = ta.crossover(src, sma) sellSignal = ta.crossunder(src, sma)
// Preços de StopLoss e Take Profits stopLossPrice = buySignal ? src * (1 - stopLossPercent) : na tp1Price = buySignal ? src * (1 + tp1Percent) : na tp2Price = buySignal ? src * (1 + tp2Percent) : na tp3Price = buySignal ? src * (1 + tp3Percent) : na
stopLossPriceSell = sellSignal ? src * (1 + stopLossPercent) : na tp1PriceSell = sellSignal ? src * (1 - tp1Percent) : na tp2PriceSell = sellSignal ? src * (1 - tp2Percent) : na tp3PriceSell = sellSignal ? src * (1 - tp3Percent) : na
// Plota a Média Móvel plot(sma, color=color.blue, title="SMA")
// Marcar todos os sinais var float lastBuyIndex = na var float lastSellIndex = na
if (buySignal) lastBuyIndex := bar_index if (sellSignal) lastSellIndex := bar_index
// Marcar o último sinal ativo if (not na(lastBuyIndex) and bar_index == lastBuyIndex) label.new(bar_index, src, text="Entry\n" + str.tostring(src, format.mintick), color=color.green, textcolor=color.white, style=label.style_label_up, size=size.normal) label.new(bar_index, stopLossPrice, text="SL\n" + str.tostring(stopLossPrice, format.mintick), color=color.red, textcolor=color.white, style=label.style_label_down, size=size.small) label.new(bar_index, tp1Price, text="TP1\n" + str.tostring(tp1Price, format.mintick), color=color.blue, textcolor=color.white, style=label.style_label_up, size=size.small) label.new(bar_index, tp2Price, text="TP2\n" + str.tostring(tp2Price, format.mintick), color=color.purple, textcolor=color.white, style=label.style_label_up, size=size.small) label.new(bar_index, tp3Price, text="TP3\n" + str.tostring(tp3Price, format.mintick), color=color.orange, textcolor=color.white, style=label.style_label_up, size=size.small)
if (not na(lastSellIndex) and bar_index == lastSellIndex) label.new(bar_index, src, text="Entry\n" + str.tostring(src, format.mintick), color=color.red, textcolor=color.white, style=label.style_label_down, size=size.normal) label.new(bar_index, stopLossPriceSell, text="SL\n" + str.tostring(stopLossPriceSell, format.mintick), color=color.green, textcolor=color.white, style=label.style_label_up, size=size.small) label.new(bar_index, tp1PriceSell, text="TP1\n" + str.tostring(tp1PriceSell, format.mintick), color=color.blue, textcolor=color.white, style=label.style_label_down, size=size.small) label.new(bar_index, tp2PriceSell, text="TP2\n" + str.tostring(tp2PriceSell, format.mintick), color=color.purple, textcolor=color.white, style=label.style_label_down, size=size.small) label.new(bar_index, tp3PriceSell, text="TP3\n" + str.tostring(tp3PriceSell, format.mintick), color=color.orange, textcolor=color.white, style=label.style_label_down, size=size.small)
- Assistant