这是一个基于公允价值缺口(FVG)的交易策略,结合了动态风险管理和固定获利目标。该策略在15分钟时间周期上运行,通过识别市场中的价格缺口来捕捉潜在的交易机会。根据回测数据显示,在2023年11月至2024年8月期间,该策略实现了284.40%的净收益率,总计完成153笔交易,其中盈利率达到71.24%,获利因子为2.422。
策略的核心是通过监测连续三根K线之间的价格关系来识别公允价值缺口。具体来说: 1. 多头FVG形成条件:当前一根K线的最高价低于前两根K线的最低价 2. 空头FVG形成条件:当前一根K线的最低价高于前两根K线的最高价 3. 入场信号由FVG阈值参数控制,只有当缺口大小超过价格一定百分比时才触发 4. 风险控制采用账户权益的固定比例(1%)作为止损标准 5. 获利目标采用固定点数(50点)设置
该策略通过结合公允价值缺口理论和科学的风险管理方法,展现出了良好的交易效果。策略的高盈利率和稳定的获利因子表明其具有实战价值。通过建议的优化方向,策略还有进一步提升空间。建议交易者在实盘使用前进行充分的参数优化和回测验证。
/*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)