
이 전략은 중추 가격 간격 (CPR), 지수 이동 평균 (EMA) 및 상대적으로 강한 지표 (RSI) 를 활용하여 거래하는 다중 시간 주기의 분석에 기반한 거래 시스템입니다. 이 전략은 일간 CPR 수준, 주간 오픈 가격 및 20 주기의 EMA를 통해 시장 추세와 중요한 지지 저항 지점을 식별하고 거래량을 확인하는 합성 거래를 수행합니다.
이 전략의 핵심은 가격과 CPR 레벨의 관계를 분석하여 거래 기회를 찾는 것입니다. CPR은 축점 ((Pivot), 하위 중심선 ((BC) 및 상위 중심선 ((TC) 으로 구성됩니다. 가격이 TC를 돌파하고 시장이 다단계 단계에있을 때 시스템은 여러 신호를 냅니다. 가격이 BC를 넘어 시장이 공백 단계에있을 때 시스템은 공백 신호를 냅니다.
이것은 구조적이고, 논리적으로 명확한 트렌드 추적 전략으로, 여러 기술적 지표의 조합 사용으로 거래 위험을 효과적으로 제어한다. 전략의 주요 장점은 유연한 파라미터 설정과 완벽한 위험 관리 장치에 있다. 그러나 동시에 거래자는 시장 환경의 변화에 주의를 기울이고 전략 매개 변수를 적시에 조정해야 한다. 제안된 최적화 방향으로 전략의 안정성과 수익성은 더욱 향상될 것으로 보인다.
//@version=5
strategy("Ahmad Ali Khan CPR Strategy", overlay=true, margin_long=100, margin_short=100)
// ———— Inputs ————
use_daily_cpr = input.bool(true, "Use Daily CPR Levels")
ema_length = input.int(20, "EMA Trend Filter Length")
show_week_open = input.bool(true, "Show Weekly Open Price")
enable_divergence = input.bool(true, "Enable RSI Divergence Check")
// ———— Daily CPR Calculation ————
daily_high = request.security(syminfo.tickerid, "D", high[1], lookahead=barmerge.lookahead_on)
daily_low = request.security(syminfo.tickerid, "D", low[1], lookahead=barmerge.lookahead_on)
daily_close = request.security(syminfo.tickerid, "D", close[1], lookahead=barmerge.lookahead_on)
pivot = (daily_high + daily_low + daily_close) / 3
bc = (daily_high + daily_low) / 2
tc = pivot + (pivot - bc)
// ———— Weekly Open Price ————
weekly_open = request.security(syminfo.tickerid, "W", open, lookahead=barmerge.lookahead_on)
// ———— Trend Analysis ————
ema_trend = ta.ema(close, ema_length)
market_phase = close > ema_trend ? "Bullish" : "Bearish"
// ———— Momentum Confirmation ————
rsi_length = 14
rsi = ta.rsi(close, rsi_length)
bullish_div = ta.valuewhen(ta.crossover(rsi, 30), low, 0) > ta.valuewhen(ta.crossover(rsi, 30), low, 1)
bearish_div = ta.valuewhen(ta.crossunder(rsi, 70), high, 0) < ta.valuewhen(ta.crossunder(rsi, 70), high, 1)
// ———— Plotting ————
// CPR Levels
plot(pivot, "Pivot", color=color.blue, linewidth=2)
plot(bc, "BC", color=color.red, linewidth=2)
plot(tc, "TC", color=color.green, linewidth=2)
fill(plot(bc), plot(tc), color=color.new(color.purple, 90))
// Weekly Open
plot(show_week_open ? weekly_open : na, "Weekly Open", color=color.orange, linewidth=2)
// EMA Trend
plot(ema_trend, "EMA Trend", color=color.white, linewidth=2)
// ———— Strategy Logic ————
long_condition =
close > tc and
market_phase == "Bullish" and
(not enable_divergence or bullish_div) and
volume > ta.sma(volume, 20)
short_condition =
close < bc and
market_phase == "Bearish" and
(not enable_divergence or bearish_div) and
volume > ta.sma(volume, 20)
// ———— Risk Management ————
cpr_width = tc - bc
stop_loss_long = bc - (0.5 * cpr_width)
take_profit_long = tc + (1.5 * cpr_width)
stop_loss_short = tc + (0.5 * cpr_width)
take_profit_short = bc - (1.5 * cpr_width)
// ———— Execute Orders ————
if long_condition
strategy.entry("Long", strategy.long)
strategy.exit("XL", "Long", stop=stop_loss_long, limit=take_profit_long)
if short_condition
strategy.entry("Short", strategy.short)
strategy.exit("XS", "Short", stop=stop_loss_short, limit=take_profit_short)
// ———— Signal Plotting ————
plotshape(long_condition, "Buy", shape.labelup, location.belowbar, color=color.green, text="BUY", textcolor=color.white)
plotshape(short_condition, "Sell", shape.labeldown, location.abovebar, color=color.red, text="SELL", textcolor=color.white)