이 전략은 EMA 교차, RSI 이탈, 30 분 트렌드 식별 및 가격 고갈과 같은 기술 지표를 결합하여 시장 추세와 가격 절전 지점을 포착합니다. 전략은 EMA13과 EMA26의 교차를 통해 트렌드 방향을 결정하고, RSI 이탈을 사용하여 잠재적인 트렌드 반전을 식별하며, 30 분 시간 프레임 내의 트렌드 상태와 가격 고갈 상황을 고려하여 진입 지점을 최적화합니다.
이 전략은 EMA 교차, RSI 이탈, 30 분 트렌드 식별 및 가격의 모든 기술 지표를 결합하여 트렌드 및 잠재적 인 전환점을 포착하기 위해 여러 차원에서 시장을 분석합니다. 전략의 장점은 다차원 분석, 트렌드 확인, 전환점 포착 및 위험 제어에 있습니다. 그러나 변수 최적화, 트렌드 전환, 가짜 신호 및 돌발 사건과 같은 위험도 있습니다.
/*backtest
start: 2024-04-01 00:00:00
end: 2024-04-30 23:59:59
period: 2h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("EMA Cross Strategy with RSI Divergence, 30-Minute Trend Identification, and Price Exhaustion", overlay=true)
// Definição das médias móveis exponenciais para tendência de curto prazo (30 minutos)
EMA5_30min = ta.ema(close, 5)
EMA10_30min = ta.ema(close, 10)
// Definição das médias móveis exponenciais
EMA13 = ta.ema(close, 13)
EMA26 = ta.ema(close, 26)
// RSI com período padrão de 7
rsi = ta.rsi(close, 7)
// Detecção do cruzamento das EMAs
crossUp = ta.crossover(EMA13, EMA26)
crossDown = ta.crossunder(EMA13, EMA26)
// Detecção de divergência no RSI
bullishDivergence = ta.crossunder(close, EMA13) and ta.crossunder(rsi, 30)
bearishDivergence = ta.crossover(close, EMA13) and ta.crossover(rsi, 70)
// Geração de sinais de entrada
entrySignal = crossUp ? 1 : (crossDown ? -1 : 0)
// Abertura da posição
if (entrySignal == 1)
strategy.entry("Long", strategy.long)
else if (entrySignal == -1)
strategy.entry("Short", strategy.short)
// Fechamento da posição
if (entrySignal == 1 and ta.crossover(close, EMA26))
strategy.close("Long")
else if (entrySignal == -1 and ta.crossunder(close, EMA26))
strategy.close("Short")
// Comando de compra e venda
buySignal = crossUp and close > EMA13 and close > EMA26
sellSignal = crossDown and close < EMA13 and close < EMA26
// Aplicando a lógica de divergência RSI
if (bullishDivergence)
strategy.entry("Bullish Divergence", strategy.long)
if (bearishDivergence)
strategy.entry("Bearish Divergence", strategy.short)
// Identificação de tendência nos últimos 30 minutos
isUptrend30min = close > EMA5_30min and close > EMA10_30min
isDowntrend30min = close < EMA5_30min and close < EMA10_30min
// Identificação de exaustão do preço com base no RSI
isOversold = rsi < 30
isOverbought = rsi > 70
// Executando os sinais de compra e venda
if (buySignal and isUptrend30min and isOversold)
strategy.entry("Buy", strategy.long)
if (sellSignal and isDowntrend30min and isOverbought)
strategy.entry("Sell", strategy.short)