
이 전략은 가격 행동과 역동적인 지지부진 지점에 기반한 거래 시스템으로, 핵심 가격 형태를 지지부진과 저항 부위 근처에서 식별하여 거래한다. 시스템은 16주기 역동적인 지지부진 저항 계산 방법을 사용하며, 4가지의 고전적인 반전 그래픽 형태 - 子線, 유성線, 십자성 및针形 형태를 결합하여 시장의 잠재적 반전 기회를 포착한다. 전략은 고정된 비율의 스톱 손실을 사용하여 위험을 관리하고, 감수성 파라미터를 사용하여 진입 신호의 엄격성을 제어한다.
이 전략의 핵심은 가격 활동의 상하한선을 형성하는 지지부서와 저항부위를 동적으로 계산하는 것이다. 가격이 이러한 중요한 수준에 접근할 때, 시스템은 특정 그램 형태를 역전 신호로 찾는다. 입시 조건은 가격의 지지부서 저항부위의 1.8% 범위 (설정 민감도) 내에 역전 형태가 발생하도록 요구한다. 시스템은 35%의 자금 관리 규칙을 사용하며, 16%의 스톱로스와 9.5%의 스톱을 결합하여, 각 거래의 위험을 계좌 총액의 약 5.6%에 효과적으로 통제한다.
이 가격 행동 기반의 거래 전략은 동적 지원 저항 수준과 고전적 역전 모형을 결합하여 거래자에게 체계화된 거래 방법을 제공합니다. 전략의 장점은 논리적으로 명확하고, 위험은 통제 가능하지만, 실제 거래 효과에 따라 지속적인 최적화가 필요합니다. 거래자는 실물 사용 전에 충분한 피드백과 변수 최적화를 수행하고, 시장 경험과 함께 전략에 대한 개인 맞춤 조정하는 것이 좋습니다.
/*backtest
start: 2024-11-26 00:00:00
end: 2024-12-03 00:00:00
period: 1h
basePeriod: 1h
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/
// © felipemiransan
//@version=5
strategy("Price Action Strategy", overlay=true)
// Settings
length = input.int(16, title="Support and Resistance Length")
sensitivity = input.float(0.018, title="Sensitivity")
// Stop Loss and Take Profit
stop_loss_pct = input.float(16, title="Stop Loss percentage", minval=0.1) / 100
take_profit_pct = input.float(9.5, title="Take Profit percentage", minval=0.1) / 100
// Function to identify a Hammer
isHammer() =>
body = close - open
price_range = high - low
lower_shadow = open - low
upper_shadow = high - close
body > 0 and lower_shadow > body * 2 and upper_shadow < body * 0.5 and price_range > 0
// Function to identify a Shooting Star
isShootingStar() =>
body = open - close
price_range = high - low
lower_shadow = close - low
upper_shadow = high - open
body > 0 and upper_shadow > body * 2 and lower_shadow < body * 0.5 and price_range > 0
// Function to identify a Doji
isDoji() =>
body = close - open
price_range = high - low
math.abs(body) < (price_range * 0.1) // Doji has a small body
// Function to identify a Pin Bar
isPinBar() =>
body = close - open
price_range = high - low
lower_shadow = open - low
upper_shadow = high - close
(upper_shadow > body * 2 and lower_shadow < body * 0.5) or (lower_shadow > body * 2 and upper_shadow < body * 0.5)
// Support and resistance levels
support = ta.lowest(low, length)
resistance = ta.highest(high, length)
// Entry criteria
long_condition = (isHammer() or isDoji() or isPinBar()) and close <= support * (1 + sensitivity)
short_condition = (isShootingStar() or isDoji() or isPinBar()) and close >= resistance * (1 - sensitivity)
// Function to calculate stop loss and take profit (long)
calculate_levels(position_size, avg_price, stop_loss_pct, take_profit_pct) =>
stop_loss_level = avg_price * (1 - stop_loss_pct)
take_profit_level = avg_price * (1 + take_profit_pct)
[stop_loss_level, take_profit_level]
// Function to calculate stop loss and take profit (short)
calculate_levels_short(position_size, avg_price, stop_loss_pct, take_profit_pct) =>
stop_loss_level = avg_price * (1 + stop_loss_pct)
take_profit_level = avg_price * (1 - take_profit_pct)
[stop_loss_level, take_profit_level]
// Buy entry order with label
if (long_condition and strategy.opentrades == 0)
strategy.entry("Buy", strategy.long)
pattern = isHammer() ? "Hammer" : isDoji() ? "Doji" : isPinBar() ? "Pin Bar" : ""
label.new(x=bar_index, y=low, text=pattern, color=color.green, textcolor=color.black, size=size.small)
// Sell entry order with label
if (short_condition and strategy.opentrades == 0)
strategy.entry("Sell", strategy.short)
pattern = isShootingStar() ? "Shooting Star" : isDoji() ? "Doji" : isPinBar() ? "Pin Bar" : ""
label.new(x=bar_index, y=high, text=pattern, color=color.red, textcolor=color.black, size=size.small)
// Stop Loss and Take Profit management for open positions
if (strategy.opentrades > 0)
if (strategy.position_size > 0) // Long position
avg_price_long = strategy.position_avg_price // Average price of long position
[long_stop_level, long_take_profit_level] = calculate_levels(strategy.position_size, avg_price_long, stop_loss_pct, take_profit_pct)
strategy.exit("Exit Long", from_entry="Buy", stop=long_stop_level, limit=long_take_profit_level)
if (strategy.position_size < 0) // Short position
avg_price_short = strategy.position_avg_price // Average price of short position
[short_stop_level, short_take_profit_level] = calculate_levels_short(strategy.position_size, avg_price_short, stop_loss_pct, take_profit_pct)
strategy.exit("Exit Short", from_entry="Sell", stop=short_stop_level, limit=short_take_profit_level)
// Visualization of Support and Resistance Levels
plot(support, title="Support", color=color.green, linewidth=2)
plot(resistance, title="Resistance", color=color.red, linewidth=2)