
이 전략은 SuperTrend 지표와 무작위 지표 (Stochastic Oscillator) 를 결합한 트렌드 추적 거래 시스템이다. 이 전략은 SuperTrend 지표를 통해 시장 트렌드 방향을 식별하고, 무작위 지표의 오버 바이 오버 셀 신호를 거래 확인 신호로 사용한다. 이 전략은 동력 교차 방식을 채택하여 트렌드 방향에서 최적의 진입 및 출구 시기를 찾고, 동력 분석과 트렌드 추적을 완벽하게 결합한다.
이 전략의 핵심 논리는 두 가지 주요 지표의 조합에 기반합니다.
거래 규칙은 다음과 같습니다.
이 전략은 트렌드 추적과 동력 분석을 결합하여 비교적 완전한 거래 시스템을 구축합니다. 그것은 명확한 입출장 신호를 제공하는 것뿐만 아니라 위험 관리 및 변수 최적화 프레임 워크를 포함합니다. 일부 고유한 위험이 있지만, 최적화 제안은 전략의 안정성과 적응력을 더욱 향상시킬 수 있습니다.
/*backtest
start: 2024-02-21 00:00:00
end: 2024-10-01 00:00:00
period: 2d
basePeriod: 2d
exchanges: [{"eid":"Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("SuperTrend + Stochastic Strategy", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=10)
// SuperTrend Settings
superTrendFactor = input.float(3.0, title="SuperTrend Factor", step=0.1)
superTrendATRLength = input.int(10, title="SuperTrend ATR Length")
// Calculate SuperTrend
[superTrend, direction] = ta.supertrend(superTrendFactor, superTrendATRLength)
// Plot SuperTrend
plot(superTrend, color=direction == 1 ? color.green : color.red, title="SuperTrend")
bgcolor(direction == 1 ? color.new(color.green, 90) : color.new(color.red, 90), transp=90)
// Stochastic Settings
stochKLength = input.int(14, title="Stochastic %K Length")
stochDLength = input.int(3, title="Stochastic %D Length")
stochSmoothK = input.int(3, title="Stochastic %K Smoothing")
stochOverbought = input.int(80, title="Stochastic Overbought Level")
stochOversold = input.int(20, title="Stochastic Oversold Level")
// Calculate Stochastic
k = ta.sma(ta.stoch(close, high, low, stochKLength), stochSmoothK)
d = ta.sma(k, stochDLength)
// Plot Stochastic in separate pane
hline(stochOverbought, "Overbought", color=color.red)
hline(stochOversold, "Oversold", color=color.green)
plot(k, color=color.blue, title="%K", linewidth=2)
plot(d, color=color.orange, title="%D", linewidth=2)
// Long Condition: SuperTrend is up and Stochastic %K crosses above oversold
longCondition = direction == 1 and ta.crossover(k, stochOversold)
if (longCondition)
strategy.entry("Long", strategy.long)
// Short Condition: SuperTrend is down and Stochastic %K crosses below overbought
shortCondition = direction == -1 and ta.crossunder(k, stochOverbought)
if (shortCondition)
strategy.entry("Short", strategy.short)
// Exit Long: SuperTrend turns down or Stochastic %K crosses below overbought
exitLong = direction == -1 or ta.crossunder(k, stochOverbought)
if (exitLong)
strategy.close("Long")
// Exit Short: SuperTrend turns up or Stochastic %K crosses above oversold
exitShort = direction == 1 or ta.crossover(k, stochOversold)
if (exitShort)
strategy.close("Short")