
이 전략은 트렌드 추적과 간격 거래의 결합으로 시장 상태를 변동 지수 ((CI) 를 통해 판단하고, 다른 시장 환경에 따라 대응하는 거래 논리를 적용하는 자기 적응 시스템입니다. 트렌드 시장에서 전략은 EMA 교차와 RSI 초과 구매 초과 판매 신호를 사용하여 거래합니다. 간격 시장에서 전략은 RSI 지표의 극한 값에 따라 주로 거래합니다. 전략에는 위험을 제어하고 수익을 잠금하기 위해 손실 중지 장치가 포함되어 있습니다.
전략의 핵심은 변동 지수 ((CI) 를 통해 시장을 트렌드 시장 ((CI<38.2) 및 간격 시장 ((CI>61.8) 두 가지 상태로 나누는 것이다. 트렌드 시장에서, 빠른 EMA ((9주기) 에서 느린 EMA ((21주기) 를 통과하고 RSI가 70보다 낮을 때, 상점을 열고, 느린 EMA에서 빠른 EMA를 통과하고 RSI가 30보다 높을 때, 상점을 열다.
이 전략은 여러 기술 지표를 결합하여 스스로 적응하는 거래 시스템을 구축하여 다양한 시장 환경에서 안정적인 성능을 유지할 수 있습니다. 이 전략의 핵심 장점은 시장 적응성과 완벽한 위험 관리 장치에 있습니다. 그러나 또한 매개 변수 최적화 및 시장 조건 의존성 등의 문제에 주의를 기울여야합니다. 지속적인 최적화 및 개선으로 이 전략은 다양한 시장 환경에서 더 나은 거래 효과를 달성 할 수 있습니다.
/*backtest
start: 2024-12-19 00:00:00
end: 2024-12-26 00:00:00
period: 45m
basePeriod: 45m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © nopology
//@version=6
strategy("CI, EMA, RSI", overlay=false)
// Input parameters
lengthCI = input(14, title="CI Length")
lengthRSI = input(14, title="RSI Length")
fastLength = input(9, title="Fast EMA Length")
slowLength = input(21, title="Slow EMA Length")
// Calculate CI
atr = ta.atr(lengthCI)
highLowRange = math.log10(math.max(high[lengthCI], high) - math.min(low[lengthCI], low))
sumATR = math.sum(atr, lengthCI)
ci = 100 * (math.log10(sumATR / highLowRange) / math.log10(lengthCI))
// Calculate RSI
rsi = ta.rsi(close, lengthRSI)
// Calculate EMAs
fastEMA = ta.ema(close, fastLength)
slowEMA = ta.ema(close, slowLength)
// Define conditions
trendingMarket = ci < 38.2
rangingMarket = ci > 61.8
bullishSignal = ta.crossover(fastEMA, slowEMA) and rsi < 70
bearishSignal = ta.crossover(slowEMA, fastEMA) and rsi > 30
// Plot indicators for visualization
plot(ci, title="Choppiness Index", color=color.purple, linewidth=2)
plot(fastEMA, title="Fast EMA", color=color.blue)
plot(slowEMA, title="Slow EMA", color=color.red)
// Strategy Execution
if (trendingMarket)
if (bullishSignal)
strategy.entry("Long", strategy.long)
if (bearishSignal)
strategy.entry("Short", strategy.short)
else if (rangingMarket)
if (rsi < 30)
strategy.entry("Long", strategy.long)
if (rsi > 70)
strategy.entry("Short", strategy.short)
// Close positions when conditions no longer met or reverse
if (trendingMarket and not bullishSignal)
strategy.close("Long")
if (trendingMarket and not bearishSignal)
strategy.close("Short")
if (rangingMarket and rsi > 40)
strategy.close("Long")
if (rangingMarket and rsi < 60)
strategy.close("Short")
// Optional: Add stop loss and take profit
stopLossPerc = input.float(2, title="Stop Loss (%)", minval=0.1, step=0.1) / 100
takeProfitPerc = input.float(4, title="Take Profit (%)", minval=0.1, step=0.1) / 100
strategy.exit("Exit Long", "Long", stop=close*(1-stopLossPerc), limit=close*(1+takeProfitPerc))
strategy.exit("Exit Short", "Short", stop=close*(1+stopLossPerc), limit=close*(1-takeProfitPerc))