
이 전략은 트렌드 추적, 동력 지표, 그리고 적응된 스톱로드를 결합한 다차원 거래 시스템이다. 전략은 슈퍼 트렌드 지표를 통해 시장의 트렌드 방향을 식별하고, RSI 동력 지표와 평형 시스템과 결합하여 거래를 확인하고, ATR 변동률 지표를 사용하여 동력 스톱로드 관리를 구현한다. 이 다차원 분석 방법은 시장의 트렌드를 효과적으로 포착할 수 있으며, 동시에 위험을 합리적으로 제어한다.
전략의 핵심 논리는 다음 세 가지 차원에 기초합니다.
구매 조건은 다음과 같습니다: SuperTrend bullish ((녹색) + RSI <65+ 50주기 평균선 위에 있는 가격. 판매 조건: 수퍼트렌드가 하향으로 전환되면 매매한다. 스톱 관리: ATR 기반의 추적 스톱을 사용하여, 스톱 거리는 ATR 값의 1.5배이다.
이 전략은 트렌드 추적, 동력 및 평선 시스템을 통합하여 논리적으로 완전한 거래 시스템을 구축합니다. 전략의 장점은 다차원 신호 확인 메커니즘과 완벽한 위험 제어 시스템입니다. 제공되는 최적화 방향을 통해 전략에는 더 많은 개선이 가능합니다. 전략의 핵심 논리를 유지하면서 다양한 시장 환경에서의 적응력을 강화하는 것이 중요합니다.
/*backtest
start: 2025-01-08 00:00:00
end: 2025-02-07 00:00:00
period: 3h
basePeriod: 3h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Gladston_J_G
//@version=5
strategy("Trend Strategy with Stop Loss", overlay=true, margin_long=100, margin_short=100)
// ———— Inputs ———— //
atrLength = input(14, "ATR Length")
supertrendMultiplier = input(3.0, "Supertrend Multiplier")
rsiLength = input(14, "RSI Length")
maLength = input(50, "MA Length")
trailOffset = input(1.5, "Trailing Stop ATR Multiplier")
// ———— Indicators ———— //
// Supertrend for trend direction
[supertrend, direction] = ta.supertrend(supertrendMultiplier, atrLength)
// RSI for momentum filter
rsi = ta.rsi(close, rsiLength)
// Moving Average for trend confirmation
ma = ta.sma(close, maLength)
// ATR for volatility-based stop loss
atr = ta.atr(atrLength)
// ———— Strategy Logic ———— //
// Buy Signal: Supertrend bullish + RSI not overbought + Price above MA
buyCondition = direction < 0 and rsi < 65 and close > ma
// Sell Signal: Supertrend turns bearish
sellCondition = direction > 0
// ———— Stop Loss & Trailing ———— //
stopPrice = close - (atr * trailOffset)
var float trail = na
if buyCondition and strategy.position_size == 0
trail := stopPrice
else
trail := math.max(stopPrice, nz(trail[1]))
// ———— Execute Orders ———— //
strategy.entry("Long", strategy.long, when=buyCondition)
strategy.close("Long", when=sellCondition)
strategy.exit("Trail Exit", "Long", stop=trail)
// ———— Visuals ———— //
plot(supertrend, "Supertrend", color=direction < 0 ? color.green : color.red)
plot(ma, "MA", color=color.blue)
plot(strategy.position_size > 0 ? trail : na, "Trailing Stop", color=color.orange, style=plot.style_linebr)
// ———— Alerts ———— //
plotshape(buyCondition, "Buy", shape.triangleup, location.belowbar, color.green, size=size.small)
plotshape(sellCondition, "Sell", shape.triangledown, location.abovebar, color.red, size=size.small)
plot(close)