
이 전략은 역사적 신고위 돌파와 월선 평균선 필터링을 기반으로 한 트렌드 추적 전략이다. 그것은 가격이 돌파되었는지의 이전 역사적 최고점을 모니터링하여 구매 신호를 찾고, 월선 8주기 간단한 이동 평균 ((8 SMA) 을 판매 필터링 조건으로 사용하여 가짜 돌파의 위험을 줄인다. 이 전략 설계 철학은 “트렌드 연속성”이라는 시장 특성에 부합하며, 특히 강력한 상승 추세에서 큰 수준의 움직임을 포착하는 데 적합하다.
이 전략의 핵심 논리는 두 가지 핵심 부분으로 이루어져 있습니다.
이것은 합리적이고 논리적으로 명확하게 설계된 트렌드 추적 전략이다. 역사적으로 새로운 고위 돌파구와 달의 평균선을 조합하여 트렌드를 효과적으로 파악하는 것은 물론, 위험을 합리적으로 통제하는 것도 보장한다. 약간의 뒤처짐과 가짜 돌파구 위험이 있지만, 제안된 최적화 방향을 통해 전략의 전체적인 성능이 더욱 향상될 전망이다. 이 전략은 명확한 트렌드가있는 시장 환경에서 특히 적합하며, 중장기 투자에 중요한 참조 도구로 사용될 수 있다.
/*backtest
start: 2019-12-23 08:00:00
end: 2024-12-11 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Buy Signal on Close Greater Than Previous All-Time High Strategy", overlay=true)
// Initialize the previous all-time high
var float prevAllTimeHigh = na
// Update the all-time high, excluding the current bar's high (use previous bar's high)
if (na(prevAllTimeHigh) or high[1] > prevAllTimeHigh)
prevAllTimeHigh := high[1]
// Monthly closing price and 8 SMA on monthly time frame
monthlyClose = request.security(syminfo.tickerid, "M", close)
monthlySMA = ta.sma(monthlyClose, 8)
// Variables to track the last signal type
var int lastSignal = 0 // 0 = None, 1 = Buy, 2 = Sell
// Debugging output to check the all-time high and conditions
plot(prevAllTimeHigh, color=color.blue, linewidth=1, title="Previous All-Time High")
plot(monthlySMA, color=color.green, linewidth=1, title="8 SMA (Monthly)")
// Buy signal: when the latest close is greater than the previous all-time high
buySignal = close > prevAllTimeHigh and lastSignal != 1
// Sell signal: when the monthly close is below the 8 SMA
sellSignal = monthlyClose < monthlySMA and lastSignal != 2
// Update the last signal type after triggering a signal
if (buySignal)
lastSignal := 1
if (sellSignal)
lastSignal := 2
// Execute the strategy orders
if (buySignal)
strategy.entry("Buy", strategy.long)
if (sellSignal)
strategy.close("Buy")
// Optional: Plot buy and sell signals on the chart for visual reference
plotshape(series=buySignal, style=shape.labelup, location=location.belowbar, color=color.green, text="BUY", size=size.small)
plotshape(series=sellSignal, style=shape.labeldown, location=location.abovebar, color=color.red, text="SELL", size=size.small)