100% found this document useful (1 vote)
256 views2 pages

1000 %

This document outlines a trading strategy for ETH/USD using Pine Script version 5. It incorporates various technical indicators such as EMA, RSI, MACD, and ATR, along with dynamic filters for volume and wick size to determine entry and exit signals. The strategy includes options for trailing stops and visual cues for buy and sell signals on the chart.

Uploaded by

salvadorbrsc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
256 views2 pages

1000 %

This document outlines a trading strategy for ETH/USD using Pine Script version 5. It incorporates various technical indicators such as EMA, RSI, MACD, and ATR, along with dynamic filters for volume and wick size to determine entry and exit signals. The strategy includes options for trailing stops and visual cues for buy and sell signals on the chart.

Uploaded by

salvadorbrsc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

//@version=5

strategy("ETH/USD Strategy [Wunder Secure Full v2]", overlay=true,


default_qty_type=strategy.percent_of_equity, default_qty_value=100,
commission_type=strategy.commission.percent, commission_value=0.04)

// === INPUTS GERAIS ===


emaLen = input.int(61, "EMA Tendência")
rsiLen = input.int(3, "Período RSI")
macdFast = input.int(3, "MACD Fast")
macdSlow = input.int(24, "MACD Slow")
macdSig = input.int(4, "MACD Signal")
atrLen = input.int(15, "ATR para Trailing")
trailMult = input.float(1.0, "Multiplicador Trailing Stop")
trailPercent = input.float(0.01, "Trailing %", step=0.001)
sessionIni = input.int(0, "Início Sessão UTC")
sessionFim = input.int(24, "Fim Sessão UTC")

// === TOGGLES ===


usarRSIDinamico = input.bool(true, "Usar RSI Dinâmico Inteligente?")
usarRSIDiurno = input.bool(true, "Usar RSI Diurno?")
usarRSINoturno = input.bool(true, "Usar RSI Noturno?")
rsiMinLongDay = input.int(46, "RSI Min Long Diurno")
rsiMinLongNight = input.int(83, "RSI Min Long Noturno")
rsiMaxShortDay = input.int(58, "RSI Max Short Diurno")
rsiMaxShortNight= input.int(40, "RSI Max Short Noturno")

usarVolumeInst = input.bool(true, "Usar Filtro Volume Institucional?")


volumeMult = input.float(1.2, "Multiplicador Volume Institucional")
usarWickFilter = input.bool(true, "Filtrar Wick Excessivo?")
wickMax = input.float(12.0, "Wick Máx (wick/open-close)")

usarSupertrend = input.bool(true, "Usar filtro de tendência Supertrend?")


supertrendFactor = input.float(1.2, "Fator Supertrend")
supertrendATR = input.int(15, "ATR Supertrend")
precoBaseST = input.string("hl2", "Preço base para Supertrend", options=["hl2",
"hl3", "ohlc4", "close", "open", "hlc3", "weighted"])

usarSaidaReversao = input.bool(true, "Ativar saída técnica por reversão?")

// === FUNÇÕES BASE ===


getSource(srcSel) =>
srcSel == "hl2" ? hl2 : srcSel == "hl3" ? (high + low + close) / 3
: srcSel == "ohlc4" ? ohlc4 : srcSel == "close" ? close : srcSel ==
"open" ? open : srcSel == "hlc3" ? (high + low + close) / 3 : srcSel
== "weighted" ? (high + low + close + close) / 4 : hl2

priceSource = getSource(precoBaseST)
ema = ta.ema(close, emaLen)
rsi = ta.rsi(close, rsiLen)
[macdLine, signalLine, _] = ta.macd(close, macdFast, macdSlow, macdSig)
atr = ta.atr(atrLen)

// === SUPERTREND ===


atrST = ta.atr(supertrendATR)
upperBand = priceSource + supertrendFactor * atrST
lowerBand = priceSource - supertrendFactor * atrST
inUpTrend = close[1] > upperBand[1] ? true : close[1] < lowerBand[1] ? false : na
inUpTrend := na(inUpTrend) ? inUpTrend[1] : inUpTrend
// === RSI INTELIGENTE ===
rsiMinLong = hour >= 10 and hour <= 16 ? (usarRSIDiurno ? rsiMinLongDay : 0) :
(usarRSINoturno ? rsiMinLongNight : 0)
rsiMaxShort = hour >= 10 and hour <= 16 ? (usarRSIDiurno ? rsiMaxShortDay : 100) :
(usarRSINoturno ? rsiMaxShortNight : 100)

// === FILTROS ===


volInstitutional = volume > volumeMult * ta.sma(volume, 20)
wickSize = math.abs(high - low) / math.max(math.abs(close - open), 1)
wickPass = wickSize <= wickMax
inSession = (hour >= sessionIni and hour <= sessionFim)

// === CONDIÇÕES DE ENTRADA ===


longSignal = close > ema and macdLine > signalLine and rsi > rsiMinLong and
inSession and (not usarVolumeInst or volInstitutional) and (not usarWickFilter or
wickPass) and (not usarSupertrend or inUpTrend)
shortSignal = close < ema and macdLine < signalLine and rsi < rsiMaxShort and
inSession and (not usarVolumeInst or volInstitutional) and (not usarWickFilter or
wickPass) and (not usarSupertrend or not inUpTrend)

// === ENTRADAS ===


if (longSignal and strategy.position_size == 0)
strategy.entry("Long", strategy.long)
if (shortSignal and strategy.position_size == 0)
strategy.entry("Short", strategy.short)

// === SAÍDA TÉCNICA REVERSIVA ===


longExitReversao = usarSaidaReversao and strategy.position_size > 0 and (macdLine <
signalLine or rsi < rsiMinLong or close < ema)
shortExitReversao = usarSaidaReversao and strategy.position_size < 0 and (macdLine
> signalLine or rsi > rsiMaxShort or close > ema)

// === TRAILING STOP ===


trailValue = math.max(close * trailPercent / 100, atr * trailMult)
trailPts = trailValue / syminfo.mintick

strategy.exit("Exit Long", from_entry="Long", trail_points=trailPts,


trail_offset=trailPts, when=barstate.isconfirmed or longExitReversao)
strategy.exit("Exit Short", from_entry="Short", trail_points=trailPts,
trail_offset=trailPts, when=barstate.isconfirmed or shortExitReversao)

// === VISUAL ===


plotshape(longSignal, title="BUY", location=location.belowbar,
style=shape.triangleup, color=color.green, text="BUY")
plotshape(shortSignal, title="SELL", location=location.abovebar,
style=shape.triangledown, color=color.red, text="SELL")
plotshape(longExitReversao, title="EXIT LONG", location=location.abovebar,
color=color.gray, style=shape.labeldown, text="EXIT L")
plotshape(shortExitReversao, title="EXIT SHORT", location=location.belowbar,
color=color.gray, style=shape.labelup, text="EXIT S")

plot(usarSupertrend ? upperBand : na, title="UpperBand ST", color=color.red)


plot(usarSupertrend ? lowerBand : na, title="LowerBand ST", color=color.green)
bgcolor(usarSupertrend ? (inUpTrend ? color.new(color.green, 92) :
color.new(color.red, 92)) : na)

You might also like