
이 전략은 지지/저항 ((S/R) 브레이크/반전, 거래량 필터링 및 경보 시스템을 결합하여 시장의 중요한 전환점을 잡기 위해 고안되었습니다. 이 전략은 가격의 브레이크 또는 반전 신호를 식별하여 거래 신호의 신뢰성을 높이기 위해 비정상적인 거래량 확인과 결합합니다.
ta.pivothigh()그리고ta.pivotlow()이 함수는 지정된 주기 ([[pivotLen]]) 내에 중요한 가격 수준을 식별한다. 가격이 저항 지점을 돌파했을 때 ([[1%) 상향 또는 지지 지점에서 반발했을 때 ([[하향 후 회수)) 신호를 유발한다.strategy.exit()성취하다.이 전략은 삼중 검증 (가격 위치, 거래량, 가격 행동) 을 통해 높은 확률 거래 프레임워크를 설계하여 트렌드 초기에 특히 적합합니다. 핵심 장점은 논리 투명성, 위험 제어 가능하지만, 불안정한 시장에서 한계를 주의하십시오. 미래 최적화는 변수 자조와 트렌드 필터링에 초점을 맞출 수 있습니다.
/*backtest
start: 2024-04-24 00:00:00
end: 2024-12-31 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"DOGE_USDT"}]
*/
//@version=5
strategy("S/R Breakout/Reversal + Volume + Alerts", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100)
// === INPUTS ===
pivotLen = input.int(10, "Pivot Lookback for S/R")
volSmaLength = input.int(20, "Volume SMA Length")
volMultiplier = input.float(1.5, "Volume Multiplier")
tpPerc = input.float(3.0, "Take Profit %", step=0.1)
slPerc = 2.0 // Stop Loss fixed at 2%
// === S/R ZONES ===
pivotHigh = ta.pivothigh(high, pivotLen, pivotLen)
pivotLow = ta.pivotlow(low, pivotLen, pivotLen)
var float resZone = na
var float supZone = na
if not na(pivotHigh)
resZone := pivotHigh
if not na(pivotLow)
supZone := pivotLow
plot(supZone, title="Support", color=color.green, linewidth=2, style=plot.style_linebr)
plot(resZone, title="Resistance", color=color.red, linewidth=2, style=plot.style_linebr)
// === VOLUME FILTER ===
volSma = ta.sma(volume, volSmaLength)
highVolume = volume > volSma * volMultiplier
// === LONG LOGIC ===
priceAboveRes = close > resZone * 1.01
nearSupport = close >= supZone * 0.99 and close <= supZone * 1.01
rejectSupport = low <= supZone and close > supZone
longBreakoutCond = priceAboveRes and highVolume
longReversalCond = nearSupport and rejectSupport and highVolume
longCondition = longBreakoutCond or longReversalCond
// === SHORT LOGIC ===
priceBelowSup = close < supZone * 0.99
nearResistance = close >= resZone * 0.99 and close <= resZone * 1.01
rejectResistance = high >= resZone and close < resZone
shortBreakoutCond = priceBelowSup and highVolume
shortReversalCond = nearResistance and rejectResistance and highVolume
shortCondition = shortBreakoutCond or shortReversalCond
// === ENTRIES WITH LABELS ===
if (longCondition)
strategy.entry("Long", strategy.long)
label.new(bar_index, low * 0.995, "BUY", style=label.style_label_up, color=color.green, textcolor=color.white)
if (shortCondition)
strategy.entry("Short", strategy.short)
label.new(bar_index, high * 1.005, "SELL", style=label.style_label_down, color=color.red, textcolor=color.white)
// === TP/SL ===
longTP = close * (1 + tpPerc / 100)
longSL = close * (1 - slPerc / 100)
shortTP = close * (1 - tpPerc / 100)
shortSL = close * (1 + slPerc / 100)
strategy.exit("Long TP/SL", from_entry="Long", limit=longTP, stop=longSL)
strategy.exit("Short TP/SL", from_entry="Short", limit=shortTP, stop=shortSL)
// === ALERT CONDITIONS ===
alertcondition(longCondition, title="Buy Alert", message="🔔 BUY signal: S/R + Volume breakout/reversal")
alertcondition(shortCondition, title="Sell Alert", message="🔔 SELL signal: S/R + Volume breakout/reversal")