
이 전략은 상대적으로 강한 지수 ((RSI) 와 평균 실제 파도 ((ATR) 를 결합한 다단계 역동적인 비용평균 (DCA) 거래 시스템이다. 이는 주로 시장 과매도 조건을 식별하여 대량으로 포지션을 구축하고 ATR을 동적으로 조정하여 교두보 위치를 조정하여 배역 운영을 통해 수익을 얻는다. 이 전략은 위험 분산, 비용 최적화 및 수익 안정성 등의 특징을 가지고 있다.
전략은 4시간 또는 일선 수준에서 작동하며, 핵심 논리는 다음과 같은 몇 가지 측면을 포함합니다:
이 전략은 RSI와 ATR 지표의 결합을 통해 위험 제어와 수익 안정성을 겸비한 거래 시스템을 구현한다. 분기 포지션 메커니즘은 비용 최적화의 가능성을 제공하며, 동적 막기의 디자인은 수익의 합리적인 수행을 보장한다. 약간의 잠재적인 위험이 있지만, 합리적인 매개 변수 설정과 최적화 방향의 구현을 통해 전략의 전체적인 성능은 더욱 향상될 것이다.
/*backtest
start: 2024-02-21 00:00:00
end: 2025-02-18 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Binance","currency":"DOGE_USDT"}]
*/
//@version=6
strategy("DCA-Based Swing Strategy (Risk $200) with Signals", overlay=true)
// === Main Indicators ===
// RSI for identifying oversold conditions
rsi = ta.rsi(close, 14)
// ATR for volatility estimation
atr = ta.atr(14)
// === Strategy Parameters ===
// Risk management
riskPerTrade = 200 // Total risk ($200)
atrRisk = 2 * atr // Risk in dollars per buy (2 ATR)
positionSize = riskPerTrade / atrRisk // Position size (shares)
// DCA Parameters
maxEntries = 4 // Maximum of 4 buys
takeProfitATR = 3 // Take profit: 3 ATR
// === Position Management ===
var float avgEntryPrice = na // Average entry price
var int entryCount = 0 // Number of buys
var line takeProfitLine = na // Take profit line
var line avgPriceLine = na // Average entry price line
// === Buy and Sell Conditions ===
buyCondition = rsi < 30 and entryCount < maxEntries // Buy when oversold
if (buyCondition)
strategy.entry("DCA Buy", strategy.long, qty=positionSize)
// Update the average entry price
avgEntryPrice := na(avgEntryPrice) ? close : (avgEntryPrice * entryCount + close) / (entryCount + 1)
entryCount += 1
// Display "BUY" signal on the chart
label.new(bar_index, low, "BUY", style=label.style_label_up, color=color.green, textcolor=color.white, size=size.normal)
// Update lines for average entry price and take profit
if (not na(takeProfitLine))
line.delete(takeProfitLine)
if (not na(avgPriceLine))
line.delete(avgPriceLine)
takeProfitPrice = avgEntryPrice + takeProfitATR * atr
// Sell condition: Take profit = 3 ATR from average entry price
takeProfitPrice = avgEntryPrice + takeProfitATR * atr
if (close >= takeProfitPrice and entryCount > 0)
strategy.close("DCA Buy")
// Reset parameters after closing
avgEntryPrice := na
entryCount := 0
// Remove lines after selling
if (not na(takeProfitLine))
line.delete(takeProfitLine)
if (not na(avgPriceLine))
line.delete(avgPriceLine)