10 indicadores Pine Script criados com AI
Showcase de 10 indicadores Pine Script v5 gerados com Claude/ChatGPT. Códigos completos, prontos para copiar no TradingView. Do básico ao avançado.
Em vez de teoria, vou mostrar resultados práticos. 10 indicadores Pine Script v5 que você pode copiar agora e usar no seu TradingView. Todos foram criados com prompts AI (Claude/ChatGPT) em minutos. Estudo o código, entenda a lógica, adapte ao seu estilo.
Como usar este artigo
Cada indicador inclui:
- O que faz e quando usar
- Prompt usado para gerar (você pode adaptar)
- Código Pine v5 completo (copia direto pro TradingView)
- Como customizar
Como aplicar no TradingView:
- Abra TradingView
- Pine Editor (canto inferior)
- Cole o código
- Clique “Save” e dê um nome
- Clique “Add to chart”
1. EMA Crossover com filtro de tendência
O que faz: Identifica cruzamentos de EMA rápida e lenta, mas APENAS quando confirmado pela EMA 200 (tendência maior).
Quando usar: Trend following em swing trade H4/Daily.
// EMA Crossover com filtro EMA 200 //@version=5 indicator("EMA Crossover Filtered", overlay=true) fastLen = input.int(9, "EMA Rapida") slowLen = input.int(21, "EMA Lenta") trendLen = input.int(200, "EMA Tendencia") emaFast = ta.ema(close, fastLen) emaSlow = ta.ema(close, slowLen) emaTrend = ta.ema(close, trendLen) bullCross = ta.crossover(emaFast, emaSlow) and close > emaTrend bearCross = ta.crossunder(emaFast, emaSlow) and close < emaTrend plot(emaFast, "EMA 9", color=color.new(#16a34a, 0)) plot(emaSlow, "EMA 21", color=color.new(#b8893d, 0)) plot(emaTrend, "EMA 200", color=color.new(color.black, 0), linewidth=2) plotshape(bullCross, "Bull", shape.triangleup, location.belowbar, color=color.green, size=size.small) plotshape(bearCross, "Bear", shape.triangledown, location.abovebar, color=color.red, size=size.small) alertcondition(bullCross, "Bull Crossover", "EMA crossover bullish confirmado") alertcondition(bearCross, "Bear Crossover", "EMA crossover bearish confirmado")
Customização: Ajuste períodos. Para day trade: 5/13/50. Para swing: 9/21/200. Para position: 21/55/200.
2. RSI Divergence Detector
O que faz: Detecta divergências bullish e bearish entre preço e RSI automaticamente.
Quando usar: Identificar reversões em fim de tendência.
// RSI Divergence Detector //@version=5 indicator("RSI Divergence", overlay=false) rsiLen = input.int(14, "RSI") pivotLen = input.int(5, "Pivot Period") rsi = ta.rsi(close, rsiLen) priceHigh = ta.pivothigh(high, pivotLen, pivotLen) priceLow = ta.pivotlow(low, pivotLen, pivotLen) rsiHigh = ta.pivothigh(rsi, pivotLen, pivotLen) rsiLow = ta.pivotlow(rsi, pivotLen, pivotLen) var float prevPriceLow = na var float prevRsiLow = na var float prevPriceHigh = na var float prevRsiHigh = na bullishDiv = false bearishDiv = false if not na(priceLow) and not na(rsiLow) if not na(prevPriceLow) and priceLow < prevPriceLow and rsiLow > prevRsiLow bullishDiv := true prevPriceLow := priceLow prevRsiLow := rsiLow if not na(priceHigh) and not na(rsiHigh) if not na(prevPriceHigh) and priceHigh > prevPriceHigh and rsiHigh < prevRsiHigh bearishDiv := true prevPriceHigh := priceHigh prevRsiHigh := rsiHigh plot(rsi, "RSI", color=color.new(#b8893d, 0)) hline(70, "Sobrecompra", color=color.new(color.red, 50)) hline(30, "Sobrevenda", color=color.new(color.green, 50)) plotshape(bullishDiv, "Bull Div", shape.triangleup, location.bottom, color=color.green, size=size.small) plotshape(bearishDiv, "Bear Div", shape.triangledown, location.top, color=color.red, size=size.small) alertcondition(bullishDiv, "Bullish Divergence") alertcondition(bearishDiv, "Bearish Divergence")
3. Multi-Timeframe Trend Dashboard
O que faz: Mostra tendência em 4 timeframes simultâneos (M15, H1, H4, Daily) em uma tabela no canto do gráfico.
Quando usar: Confirmar alinhamento de timeframes antes de operar.
// Multi-TF Trend Dashboard //@version=5 indicator("MTF Trend Dashboard", overlay=true) getTrend(tf) => ema50 = request.security(syminfo.tickerid, tf, ta.ema(close, 50)) ema200 = request.security(syminfo.tickerid, tf, ta.ema(close, 200)) price = request.security(syminfo.tickerid, tf, close) price > ema50 and ema50 > ema200 ? "ALTA" : price < ema50 and ema50 < ema200 ? "BAIXA" : "LATERAL" t15 = getTrend("15") t60 = getTrend("60") t240 = getTrend("240") tD = getTrend("D") getColor(t) => t == "ALTA" ? color.green : t == "BAIXA" ? color.red : color.gray var table dashboard = table.new(position.top_right, 2, 5, border_width=1) if barstate.islast table.cell(dashboard, 0, 0, "TF", bgcolor=color.black, text_color=color.white) table.cell(dashboard, 1, 0, "Tendencia", bgcolor=color.black, text_color=color.white) table.cell(dashboard, 0, 1, "M15") table.cell(dashboard, 1, 1, t15, bgcolor=getColor(t15), text_color=color.white) table.cell(dashboard, 0, 2, "H1") table.cell(dashboard, 1, 2, t60, bgcolor=getColor(t60), text_color=color.white) table.cell(dashboard, 0, 3, "H4") table.cell(dashboard, 1, 3, t240, bgcolor=getColor(t240), text_color=color.white) table.cell(dashboard, 0, 4, "D") table.cell(dashboard, 1, 4, tD, bgcolor=getColor(tD), text_color=color.white)
4. Volatility-Adjusted Position Size Helper
O que faz: Calcula automaticamente o stop loss baseado em ATR (volatilidade atual) e mostra position size sugerido.
Quando usar: Antes de cada trade — adapta stop ao quão volátil está o mercado.
// Volatility-Adjusted Position Size Helper //@version=5 indicator("Vol-Adjusted Position Helper", overlay=true) atrLen = input.int(14, "ATR Period") atrMult = input.float(1.5, "ATR Multiplicador (Stop)") balance = input.float(5000, "Saldo USD") riskPct = input.float(1.0, "Risco % por trade") pipValue = input.float(10.0, "Pip Value por lote (USD)") atr = ta.atr(atrLen) stopDistance = atr * atrMult stopPips = stopDistance * 10000 riskUSD = balance * (riskPct / 100) suggestedLots = riskUSD / (stopPips * pipValue / 10) stopLossLong = close - stopDistance stopLossShort = close + stopDistance plot(stopLossLong, "Stop Loss Long", color=color.new(color.red, 50), style=plot.style_circles) plot(stopLossShort, "Stop Loss Short", color=color.new(color.red, 50), style=plot.style_circles) var table info = table.new(position.bottom_right, 2, 5, border_width=1, bgcolor=color.new(color.black, 10)) if barstate.islast table.cell(info, 0, 0, "ATR", text_color=color.white) table.cell(info, 1, 0, str.tostring(atr, "#.####"), text_color=color.white) table.cell(info, 0, 1, "Stop (pips)", text_color=color.white) table.cell(info, 1, 1, str.tostring(stopPips, "#.#"), text_color=color.yellow) table.cell(info, 0, 2, "Risco USD", text_color=color.white) table.cell(info, 1, 2, str.tostring(riskUSD, "$#.##"), text_color=color.red) table.cell(info, 0, 3, "Lotes", text_color=color.white) table.cell(info, 1, 3, str.tostring(suggestedLots, "#.###"), text_color=#b8893d) table.cell(info, 0, 4, "Risco %", text_color=color.white) table.cell(info, 1, 4, str.tostring(riskPct) + "%", text_color=color.white)
5. Session Highlighter (Asia/London/NY)
O que faz: Pinta o background do gráfico nas sessões de trading globais.
Quando usar: Visualizar quando está em horário de alta liquidez. Especial para traders BR (sessão Londres = madrugada).
// Session Highlighter PT-BR //@version=5 indicator("Session Highlighter BR", overlay=true) // Horarios UTC (London 7-15h UTC = 4-12h BR) isAsia = time(timeframe.period, "2300-0700", "GMT") isLondon = time(timeframe.period, "0700-1500", "GMT") isNY = time(timeframe.period, "1300-2100", "GMT") isOverlap = time(timeframe.period, "1300-1500", "GMT") bgcolor(isAsia ? color.new(color.purple, 92) : na, title="Asia") bgcolor(isLondon and not isOverlap ? color.new(color.blue, 92) : na, title="London") bgcolor(isNY and not isOverlap ? color.new(color.orange, 92) : na, title="NY") bgcolor(isOverlap ? color.new(color.green, 85) : na, title="Overlap LON/NY")
6. Pivot Points Daily/Weekly
O que faz: Plota pivôs clássicos (Daily e Weekly) com níveis R1, R2, S1, S2.
Quando usar: Identificar S/R automatic para o dia/semana.
// Pivot Points Daily + Weekly //@version=5 indicator("Pivots D/W", overlay=true) // Pivots Daily [dH, dL, dC] = request.security(syminfo.tickerid, "D", [high[1], low[1], close[1]]) dP = (dH + dL + dC) / 3 dR1 = 2 * dP - dL dS1 = 2 * dP - dH dR2 = dP + (dH - dL) dS2 = dP - (dH - dL) // Pivots Weekly [wH, wL, wC] = request.security(syminfo.tickerid, "W", [high[1], low[1], close[1]]) wP = (wH + wL + wC) / 3 wR1 = 2 * wP - wL wS1 = 2 * wP - wH plot(dP, "D Pivot", color=color.new(#b8893d, 0), linewidth=2) plot(dR1, "D R1", color=color.new(color.red, 30)) plot(dS1, "D S1", color=color.new(color.green, 30)) plot(dR2, "D R2", color=color.new(color.red, 50), style=plot.style_circles) plot(dS2, "D S2", color=color.new(color.green, 50), style=plot.style_circles) plot(wP, "W Pivot", color=color.new(color.purple, 0), linewidth=3) plot(wR1, "W R1", color=color.new(color.purple, 40), style=plot.style_circles) plot(wS1, "W S1", color=color.new(color.purple, 40), style=plot.style_circles)
7. Volume Profile Lite
O que faz: Versão simplificada de volume profile — mostra zonas de alto/baixo volume nas últimas N barras.
Quando usar: Identificar zonas onde mais volume foi negociado = S/R real.
// Volume Profile Lite //@version=5 indicator("Volume Profile Lite", overlay=true, max_lines_count=50) lookback = input.int(100, "Barras Lookback") bins = input.int(20, "Numero de Niveis") var array<float> volProfile = array.new_float(bins, 0) var array<float> priceLevels = array.new_float(bins, 0) if bar_index >= lookback highRange = ta.highest(high, lookback) lowRange = ta.lowest(low, lookback) binSize = (highRange - lowRange) / bins if barstate.islast array.fill(volProfile, 0) for i = 0 to bins - 1 array.set(priceLevels, i, lowRange + binSize * i) for i = 0 to lookback - 1 barPrice = (high[i] + low[i]) / 2 barVol = volume[i] binIndex = int((barPrice - lowRange) / binSize) binIndex := math.min(binIndex, bins - 1) binIndex := math.max(binIndex, 0) array.set(volProfile, binIndex, array.get(volProfile, binIndex) + barVol) maxVol = array.max(volProfile) for i = 0 to bins - 1 vol = array.get(volProfile, i) price = array.get(priceLevels, i) intensity = int((vol / maxVol) * 100) barColor = color.new(#b8893d, 100 - intensity) line.new(bar_index - lookback, price, bar_index, price, color=barColor, width=1)
8. Smart Money Concept – Liquidity Sweep
O que faz: Detecta liquidity sweeps (preço rompe high/low e volta) — conceito popular de SMC.
Quando usar: Identificar manipulação institucional antes de reversão.
// Liquidity Sweep Detector //@version=5 indicator("Liquidity Sweep", overlay=true) lookback = input.int(20, "Lookback Period") recentHigh = ta.highest(high[1], lookback) recentLow = ta.lowest(low[1], lookback) bullSweep = low < recentLow and close > recentLow and close > open bearSweep = high > recentHigh and close < recentHigh and close < open plotshape(bullSweep, "Bull Sweep", shape.diamond, location.belowbar, color=color.green, size=size.normal) plotshape(bearSweep, "Bear Sweep", shape.diamond, location.abovebar, color=color.red, size=size.normal) plot(recentHigh, "Recent High", color=color.new(color.red, 50), style=plot.style_circles) plot(recentLow, "Recent Low", color=color.new(color.green, 50), style=plot.style_circles) alertcondition(bullSweep, "Liquidity Sweep Bullish") alertcondition(bearSweep, "Liquidity Sweep Bearish")
9. Heikin-Ashi Trend Filter
O que faz: Mostra tendência clean usando Heikin-Ashi, mantendo candles regulares no gráfico.
Quando usar: Filtrar noise — sinal HA limpo indica tendência forte.
// Heikin-Ashi Trend Filter //@version=5 indicator("HA Trend Filter", overlay=true) [haO, haH, haL, haC] = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, [open, high, low, close]) haBullish = haC > haO haBearish = haC < haO streakBull = 0 streakBear = 0 if haBullish streakBull := nz(streakBull[1]) + 1 streakBear := 0 else if haBearish streakBear := nz(streakBear[1]) + 1 streakBull := 0 strongBull = streakBull >= 3 strongBear = streakBear >= 3 bgcolor(strongBull ? color.new(color.green, 90) : na) bgcolor(strongBear ? color.new(color.red, 90) : na) plotshape(strongBull and not strongBull[1], "HA Bull Start", shape.flag, location.belowbar, color=color.green, size=size.normal) plotshape(strongBear and not strongBear[1], "HA Bear Start", shape.flag, location.abovebar, color=color.red, size=size.normal)
10. Complete Trading Setup Scanner
O que faz: Combina EMA trend + RSI + Volume + S/R em sinal único validado.
Quando usar: Filtro final de qualidade — só dispara quando tudo alinha.
// Complete Setup Scanner //@version=5 indicator("Complete Setup Scanner", overlay=true) ema21 = ta.ema(close, 21) ema50 = ta.ema(close, 50) ema200 = ta.ema(close, 200) rsi = ta.rsi(close, 14) avgVol = ta.sma(volume, 20) // Conditions upTrend = ema50 > ema200 and close > ema200 downTrend = ema50 < ema200 and close < ema200 bullPullback = upTrend and low <= ema21 and close > ema21 bearPullback = downTrend and high >= ema21 and close < ema21 rsiOk_Bull = rsi < 50 and rsi > rsi[1] rsiOk_Bear = rsi > 50 and rsi < rsi[1] volOk = volume > avgVol * 1.2 bigCandle = math.abs(close - open) > (high - low) * 0.5 // Final Signal: ALL must align finalBuy = bullPullback and rsiOk_Bull and volOk and bigCandle and close > open finalSell = bearPullback and rsiOk_Bear and volOk and bigCandle and close < open plot(ema21, "EMA 21", color=color.new(#16a34a, 0)) plot(ema50, "EMA 50", color=color.new(#b8893d, 0)) plot(ema200, "EMA 200", color=color.new(color.black, 0), linewidth=2) plotshape(finalBuy, "BUY", shape.labelup, location.belowbar, color=color.green, size=size.large, text="BUY", textcolor=color.white) plotshape(finalSell, "SELL", shape.labeldown, location.abovebar, color=color.red, size=size.large, text="SELL", textcolor=color.white) alertcondition(finalBuy, "COMPLETE BUY", "Setup completo bullish - todos os filtros alinhados") alertcondition(finalSell, "COMPLETE SELL", "Setup completo bearish - todos os filtros alinhados")
Como usar todos juntos
Estes 10 indicadores cobrem 90% das necessidades técnicas. Sugestão de combinação por estilo:
Swing trader iniciante:
- 1 (EMA Crossover) + 4 (Position Helper) + 5 (Sessions)
Swing trader avançado:
- 3 (MTF Dashboard) + 6 (Pivots) + 10 (Complete Scanner)
Day trader:
- 1 + 5 (Sessions crucial) + 8 (Liquidity Sweep)
Trend follower puro:
- 3 (MTF) + 9 (HA Trend) + 2 (Divergence para saída)
Comece copiando 1-2 indicadores. Domine eles antes de adicionar mais. Indicadores demais no gráfico = paralisia analítica.
Pratique no TradingView grátis
Todos esses indicadores funcionam na conta free. Copie, modifique, adapte.
Como criar indicadores Ferramentas grátis