6 exemplos Pine, prontos a colar.
Indicadores e estratégias que enviam webhooks TheConnector. Copie, cole no Pine Editor do TradingView, crie o alerta. Sem ajustes exceto o account do payload.
EMA Crossover (9/21)
Cruzamento de médias móveis exponenciais. O clássico para seguir a tendência de curto prazo.
//@version=5
indicator("EMA Crossover → TC", overlay=true)
fast = ta.ema(close, 9)
slow = ta.ema(close, 21)
bull = ta.crossover(fast, slow)
bear = ta.crossunder(fast, slow)
plot(fast, color=color.lime)
plot(slow, color=color.orange)
if bull
alert('{"action":"buy","symbol":"' + syminfo.ticker + '","volume":0.10}', alert.freq_once_per_bar_close)
if bear
alert('{"action":"sell","symbol":"' + syminfo.ticker + '","volume":0.10}', alert.freq_once_per_bar_close)
RSI Mean Reversion (14)
Reversão em sobrevenda/sobrecompra com SL/TP baseados em ATR. Estratégia completa, alerta por ordem.
//@version=5
strategy("RSI MR → TC", overlay=true)
rsi = ta.rsi(close, 14)
atr = ta.atr(14)
if ta.crossover(rsi, 30)
sl = close - atr * 1.5
tp = close + atr * 3.0
msg = '{"action":"buy","symbol":"' + syminfo.ticker + '","volume":0.10,"sl":' + str.tostring(sl, "#.#####") + ',"tp":' + str.tostring(tp, "#.#####") + '}'
strategy.entry("L", strategy.long, alert_message=msg)
if ta.crossunder(rsi, 70)
sl = close + atr * 1.5
tp = close - atr * 3.0
msg = '{"action":"sell","symbol":"' + syminfo.ticker + '","volume":0.10,"sl":' + str.tostring(sl, "#.#####") + ',"tp":' + str.tostring(tp, "#.#####") + '}'
strategy.entry("S", strategy.short, alert_message=msg)
Donchian Breakout (20)
Rutura da máxima / mínima de 20 velas. Clássico turtle trading.
//@version=5
indicator("Donchian 20 → TC", overlay=true)
hh = ta.highest(high, 20)[1]
ll = ta.lowest(low, 20)[1]
plot(hh, color=color.lime)
plot(ll, color=color.red)
if close > hh
alert('{"action":"buy","symbol":"' + syminfo.ticker + '","volume":0.10}', alert.freq_once_per_bar_close)
if close < ll
alert('{"action":"sell","symbol":"' + syminfo.ticker + '","volume":0.10}', alert.freq_once_per_bar_close)
Opening Range Breakout
Rutura da primeira hora da sessão (08:00-09:00 Paris). Ideal índices e futuros.
//@version=5
strategy("OR Breakout → TC", overlay=true)
inOR = time("60", "0800-0900", "Europe/Paris")
hh = ta.valuewhen(not inOR and inOR[1], high, 0)
ll = ta.valuewhen(not inOR and inOR[1], low, 0)
if not inOR and close > hh
strategy.entry("L", strategy.long, alert_message='{"action":"buy","symbol":"US500","volume":1.0}')
if not inOR and close < ll
strategy.entry("S", strategy.short, alert_message='{"action":"sell","symbol":"US500","volume":1.0}')
MACD Signal
Cruzamento MACD/sinal clássico. Sinal de tendência de médio prazo.
//@version=5
indicator("MACD → TC")
[m, s, _] = ta.macd(close, 12, 26, 9)
plot(m, color=color.blue)
plot(s, color=color.orange)
if ta.crossover(m, s)
alert('{"action":"buy","symbol":"' + syminfo.ticker + '","volume":0.10}', alert.freq_once_per_bar_close)
if ta.crossunder(m, s)
alert('{"action":"sell","symbol":"' + syminfo.ticker + '","volume":0.10}', alert.freq_once_per_bar_close)
Bollinger Bands Mean Rev
Retorno à média após tocar uma banda externa. Ideal mercados em range.
//@version=5
strategy("BB MR → TC", overlay=true)
[mid, up, dn] = ta.bb(close, 20, 2)
plot(up)
plot(dn)
plot(mid)
if ta.crossover(close, dn)
strategy.entry("L", strategy.long, alert_message='{"action":"buy","symbol":"' + syminfo.ticker + '","volume":0.10}')
if ta.crossunder(close, up)
strategy.entry("S", strategy.short, alert_message='{"action":"sell","symbol":"' + syminfo.ticker + '","volume":0.10}')
Do Pine à sua conta de broker em 5 minutos.
Crie uma conta gratuita, cole um destes exemplos no TradingView, receba o primeiro ACK do terminal.