
이 전략은 공급과 수요의 범위와 중선 반전 기반의 거래 시스템으로, 5분 시간 프레임에 작동한다. 트렌드가 중선 위치로 회전될 때 반전 신호를 식별하여 거래하고, 미리 결정된 공급과 수요의 영역에 스톱 스로프를 설정한다. 전략은 이동 평균 ((SMA) 을 결합하여 공급과 수요의 범위를 식별하여, 중간 지점을 중요한 가격 참조 수준으로 사용하여 트렌드 방향을 결정한다.
전략의 핵심 논리에는 다음과 같은 핵심 요소가 포함됩니다.
동적 공급 수요 간 중선 역전 전략은 기술 분석의 여러 차원을 결합한 거래 시스템으로, 공급 수요 간, 트렌드 및 가격 형태의 조합을 통해 시장 기회를 포착한다. 이 전략의 핵심 장점은 명확한 논리 프레임 워크와 완벽한 위험 관리 시스템이지만, 동시에 거래자가 시장 환경의 변화에 주의 깊게 관찰하고 매개 변수 설정을 적시에 조정해야 한다. 제안된 최적화 방향으로 전략의 안정성과 적응성이 더욱 향상될 전망이다.
/*backtest
start: 2025-02-16 00:00:00
end: 2025-02-23 00:00:00
period: 1m
basePeriod: 1m
exchanges: [{"eid":"Binance","currency":"SOL_USDT"}]
*/
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © bommytarton
//@version=6
strategy("Midline Rejection Entry with TP/SL at Supply/Demand", overlay=true)
// User inputs for Swing Length and Length for Supply/Demand Zones
length = input.int(50, title="Swing Length", minval=1)
midlineLength = input.int(20, title="Midline Length for Trend", minval=1) // Moving average length for trend
// Identify swing highs (Supply Zone) and swing lows (Demand Zone)
supplyZone = ta.highest(high, length) // Supply Zone (resistance)
demandZone = ta.lowest(low, length) // Demand Zone (support)
// Calculate the midpoint between supply and demand zones
midpoint = (supplyZone + demandZone) / 2
// Trend Detection: Use a simple moving average (SMA) for trend direction
smaTrend = ta.sma(close, midlineLength)
// Variables to store Supply/Demand Zones at the time of entry
var float entrySupplyZone = na
var float entryDemandZone = na
var float entryMidpoint = na
// Entry Conditions
// 1. Price in an uptrend (close above SMA)
longCondition = close > smaTrend and close < midpoint and close > open and open < close[1] and close[1] < open[1]
// 1. Price in a downtrend (close below SMA)
shortCondition = close < smaTrend and close > midpoint and close < open and open > close[1] and close[1] > open[1]
// Close any open trades before opening a new one
if (longCondition or shortCondition)
strategy.close_all()
// Execute the entry logic
if (longCondition)
entrySupplyZone := supplyZone // Store Supply Zone for Take Profit
entryDemandZone := demandZone // Store Demand Zone for Stop Loss
entryMidpoint := midpoint // Store Midpoint
strategy.entry("Long", strategy.long)
label.new(bar_index, low, "Open Long", color=color.green, textcolor=color.white, style=label.style_label_up, size=size.small)
if (shortCondition)
entrySupplyZone := supplyZone // Store Supply Zone for Stop Loss
entryDemandZone := demandZone // Store Demand Zone for Take Profit
entryMidpoint := midpoint // Store Midpoint
strategy.entry("Short", strategy.short)
label.new(bar_index, high, "Open Short", color=color.red, textcolor=color.white, style=label.style_label_down, size=size.small)
// Define Take Profit and Stop Loss Levels for Long/Short Trades
if (strategy.opentrades > 0)
// For Long trades, use Supply Zone for Take Profit and Demand Zone for Stop Loss
if (strategy.position_size > 0)
strategy.exit("Take Profit", "Long", limit=entrySupplyZone) // Take Profit at Supply Zone
strategy.exit("Stop Loss", "Long", stop=entryDemandZone) // Stop Loss at Demand Zone
// For Short trades, use Demand Zone for Take Profit and Supply Zone for Stop Loss
if (strategy.position_size < 0)
strategy.exit("Take Profit", "Short", limit=entryDemandZone) // Take Profit at Demand Zone
strategy.exit("Stop Loss", "Short", stop=entrySupplyZone) // Stop Loss at Supply Zone
// Re-Plot Supply, Midpoint, and Demand Zones after Trade Closure
plot(supplyZone, title="Supply Zone", color=color.red, linewidth=2, style=plot.style_line)
plot(demandZone, title="Demand Zone", color=color.green, linewidth=2, style=plot.style_line)
plot(midpoint, title="Midpoint", color=color.blue, linewidth=1, style=plot.style_line)