
이 전략은 수퍼트렌드 지표에 기반한 자동 거래 시스템으로, 가격과 수퍼트렌드 선의 교차를 분석하여 거래 신호를 생성한다. 전략은 고정된 ATR 주기와 곱하기 파라미터를 사용하여, 가격의 수퍼트렌드 선을 가로지르는 방향과 결합하여 시장의 흐름을 결정하고, 트렌드 추적과 자금 관리의 유기적인 결합을 구현한다.
전략의 핵심은 SuperTrend 지표를 이용하는 것입니다. 이 지표는 ATR (Average True Range) 변동률 지표에 기반을 두고 있습니다. 구체적인 구현은 다음과 같습니다.
이것은 구조가 명확하고, 논리가 엄격한 트렌드 추적 전략이다. 슈퍼 트렌드 지표의 동적 특성을 통해 트렌드 캡처와 위험 통제의 통일성을 달성한다. 전략은 강력한 실용성과 확장성을 가지고 있으며, 합리적인 매개 변수 설정과 최적화 방향을 구현함으로써 실물 거래에서 안정적인 성능을 얻을 것으로 기대된다.
/*backtest
start: 2019-12-23 08:00:00
end: 2024-12-09 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Commodity KIng", overlay=true)
// Supertrend Parameters
atr_period = 10 // Fixed ATR Period
atr_multiplier = 2.0 // Fixed ATR Multiplier
// Calculate Supertrend
[supertrend, direction] = ta.supertrend(atr_multiplier, atr_period)
// Plot Supertrend with reversed colors
plot(supertrend, color=direction > 0 ? color.red : color.green, title="Supertrend", linewidth=2)
// Buy and Sell Conditions
longCondition = ta.crossover(close, supertrend) // Buy when price crosses above Supertrend
shortCondition = ta.crossunder(close, supertrend) // Sell when price crosses below Supertrend
// Execute Buy and Sell Orders
if (longCondition)
strategy.entry("Buy", strategy.long)
if (shortCondition)
strategy.entry("Sell", strategy.short)
// Exit Conditions
if (shortCondition)
strategy.close("Buy") // Close long position if price crosses below Supertrend
if (longCondition)
strategy.close("Sell") // Close short position if price crosses above Supertrend
// Alerts
if (longCondition)
alert("Buy Signal: " + str.tostring(close), alert.freq_once_per_bar)
if (shortCondition)
alert("Sell Signal: " + str.tostring(close), alert.freq_once_per_bar)