
이것은 동적 위험 관리와 고정 수익 목표가 결합된 공정 가치 격차 (FVG) 를 기반으로 한 거래 전략입니다. 이 전략은 15 분 시간 주기에서 작동하여 시장의 가격 격차를 식별하여 잠재적인 거래 기회를 포착합니다.
전략의 핵심은 연속적인 3개의 K선 사이의 가격 관계를 모니터링하여 공정 가치 틈을 식별하는 것이다. 구체적으로:
이 전략은 공정 가치 틈새 이론과 과학적인 위험 관리 방법을 결합하여 좋은 거래 효과를 보여준다. 전략의 높은 수익률과 안정적인 수익 인자는 실제 전투 가치에 있음을 보여준다. 제안된 최적화 방향에 따라 전략은 추가로 향상시킬 여지가 있다. 거래자는 실전 사용 전에 충분한 변수 최적화 및 재검토를 수행하도록 권장한다.
/*backtest
start: 2019-12-23 08:00:00
end: 2024-11-28 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Fair Value Gap Strategy with % SL and Fixed TP", overlay=true, initial_capital=500, default_qty_type=strategy.fixed, default_qty_value=1)
// Parameters
fvgThreshold = input.float(0.5, "FVG Threshold (%)", minval=0.1, step=0.1)
// Fixed take profit in pips
takeProfitPips = 50
// Function to convert pips to price
pipsToPriceChange(pips) =>
syminfo.mintick * pips * 10
// Function to detect Fair Value Gap
detectFVG(dir) =>
gap = 0.0
if dir > 0 // Bullish FVG
gap := low[2] - high[1]
else // Bearish FVG
gap := low[1] - high[2]
math.abs(gap) > (close * fvgThreshold / 100)
// Detect FVGs
bullishFVG = detectFVG(1)
bearishFVG = detectFVG(-1)
// Entry conditions
longCondition = bullishFVG
shortCondition = bearishFVG
// Calculate take profit level
longTakeProfit = strategy.position_avg_price + pipsToPriceChange(takeProfitPips)
shortTakeProfit = strategy.position_avg_price - pipsToPriceChange(takeProfitPips)
// Calculate stop loss amount (5% of capital)
stopLossAmount = strategy.equity * 0.01
// Execute trades
if (longCondition)
strategy.entry("Long", strategy.long)
if (shortCondition)
strategy.entry("Short", strategy.short)
// Set exit conditions
if (strategy.position_size > 0)
strategy.exit("Long TP", "Long", limit=longTakeProfit)
strategy.close("Long SL", when=strategy.openprofit < -stopLossAmount)
else if (strategy.position_size < 0)
strategy.exit("Short TP", "Short", limit=shortTakeProfit)
strategy.close("Short SL", when=strategy.openprofit < -stopLossAmount)
// Plot signals
plotshape(longCondition, "Buy Signal", location = location.belowbar, color = color.green, style = shape.triangleup, size = size.small)
plotshape(shortCondition, "Sell Signal", location = location.abovebar, color = color.red, style = shape.triangledown, size = size.small)