
이 전략은 다중 기술 지표를 결합한 짧은 라인 거래 시스템이며, 주로 평행선 전환 지표 ((PSAR) 를 중심으로 한 신호이며, 평행선, 동적 지표를 결합하여 거래를 필터링하고, 동적 스톱과 고정 스톱을 결합한 리스크 관리 방법을 사용합니다. 전략 설계는 시장 추세와 변동성을 충분히 고려하여 큰 변동 시장 환경에서 짧은 라인 거래를 수행하는 데 적합합니다.
이 전략은 PSAR 지표를 주요 트렌드 판단 도구로 사용하며, 가격이 PSAR을 돌파하면 거래 신호를 발생시킨다. 신호의 신뢰성을 높이기 위해 다음과 같은 필터링 조건이 추가되었습니다.
이 전략은 여러 기술적 지표들을 결합하여 하나의 완전한 거래 시스템을 구축하고 있으며, 트렌드 판단, 위험 제어 및 거래 실행 등에 대해 잘 고려하고 있다. 이 전략의 핵심 장점은 유연한 위험 제어 장치와 완전한 신호 시스템이지만, 또한 파라미터 최적화 및 시장 적응성에 주의를 기울여야 한다. 지속적인 최적화 및 개선으로 이 전략은 다양한 시장 환경에서 안정적인 성능을 유지할 수 있을 것으로 보인다.
/*backtest
start: 2024-02-20 00:00:00
end: 2025-02-17 08:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=6
strategy("妮可百分百", overlay=true)
// 📌 設定 Parabolic SAR 參數
start = input.float(0.02, "起始 AF")
increment = input.float(0.02, "加速因子")
maximum = input.float(0.2, "最大 AF")
// 📌 計算 Parabolic SAR
SAR = ta.sar(start, increment, maximum)
// 📌 ATR 計算(用於動態止損)
atrLength = input.int(14, "ATR 計算週期")
atrMultiplier = input.float(1.3, "ATR 係數") // 2倍 ATR 作為止損範圍
ATR = ta.atr(atrLength)
// 📌 固定 0.5% 止盈計算
takeProfitPercent = 0.007 // 0.7% 固定止盈
takeProfitLong = close * (1 + takeProfitPercent) // 多單止盈
takeProfitShort = close * (1 - takeProfitPercent) // 空單止盈
// 📌 **50 EMA 過濾**
ema50 = ta.ema(close, 50)
// 📌 **RSI 過濾(防止震盪進場)**
rsiLength = input.int(14, "RSI 週期")
rsi = ta.rsi(close, rsiLength)
longFilter = rsi > 40 // 只在 RSI > 31 時做多
shortFilter = rsi < 60 // 只在 RSI < 69 時做空
// 📌 **檢查是否已經有持倉**
isFlat = strategy.position_size == 0 // **無持倉時,才能開新單**
// 🔼 **多頭進場條件**
longCondition = ta.crossover(close, SAR) and close > ema50 and longFilter and isFlat
// 🔽 **空頭進場條件**
shortCondition = ta.crossunder(close, SAR) and close < ema50 and shortFilter and isFlat
// 📌 **進場策略**
if (longCondition)
strategy.entry("B", strategy.long, comment="B")
if (shortCondition)
strategy.entry("S", strategy.short, comment="S")
// 📌 **止盈 & 止損**
stopLossLong = close - (ATR * atrMultiplier) // 多單 ATR 止損
stopLossShort = close + (ATR * atrMultiplier) // 空單 ATR 止損
strategy.exit("Exit Long", from_entry="B", stop=stopLossLong, limit=takeProfitLong, comment="TP Long")
strategy.exit("Exit Short", from_entry="S", stop=stopLossShort, limit=takeProfitShort, comment="TP Short")
// 📌 **標記進出場點**
plotshape(series=longCondition, location=location.belowbar, style=shape.triangleup, size=size.small, title="B")
plotshape(series=shortCondition, location=location.abovebar, style=shape.triangledown, size=size.small, title="S")
// 📌 **繪製 50 EMA**
plot(ema50, color=color.blue, title="50 EMA")