
This strategy is a high-frequency trading system based on Fair Value Gaps (FVG). It combines 50-period and 200-period Exponential Moving Averages (EMA) for trend confirmation, while utilizing multiple filtering indicators such as volume and price volatility to enhance signal reliability. The strategy employs a dynamic take-profit and stop-loss mechanism based on Average True Range (ATR) to ensure profits while strictly controlling risks.
The core principle is to capture trading opportunities by identifying Fair Value Gaps in price movement. When price exhibits significant gaps that align with the main trend, the strategy considers this imbalance as an indication of continued price movement in that direction. Specifically: 1. Overall trend determination using EMA50 and EMA200 relationship 2. Identification of areas with significantly increased volume (1.5 times above 20-period average) 3. Confirmation of price volatility exceeding normal levels, indicating strong market sentiment 4. Trade execution when FVG appears in the trend direction with all conditions met 5. Implementation of 2x ATR for take-profit and 1.2x ATR for stop-loss, achieving a risk-reward ratio of approximately 1.67
This strategy constructs a comprehensive trading system by combining technical analysis and market microstructure analysis methods. The core advantages lie in its multiple signal confirmation mechanism and dynamic risk control, though parameter optimization is still necessary for specific market conditions. Through continuous improvement and optimization, the strategy shows promise in maintaining stable performance across different market environments.
/*backtest
start: 2024-02-21 00:00:00
end: 2025-02-01 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Binance","currency":"ETH_USDT"}]
*/
//@version=5
strategy("Effective FVG Strategy - Forex", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=10)
// === Exponential Moving Averages for Faster Trend Detection ===
ema50 = ta.ema(close, 50)
ema200 = ta.ema(close, 200)
bullishTrend = ema50 > ema200
bearishTrend = ema50 < ema200
// === Volume & Imbalance Filters ===
highVolume = volume > ta.sma(volume, 20) * 1.5 // 1.5x higher than average volume
strongImbalance = math.abs(close - open) > ta.sma(math.abs(close - open), 20) // Large price movement
// === Fair Value Gap (FVG) Detection ===
fvgUp = low[2] > high[0] // Bullish FVG
fvgDown = high[2] < low[0] // Bearish FVG
// Effective FVGs with trend confirmation
validBullFVG = fvgUp and highVolume and strongImbalance and bullishTrend
validBearFVG = fvgDown and highVolume and strongImbalance and bearishTrend
// === ATR-based Take Profit & Stop Loss (Optimized for Forex) ===
atr = ta.atr(14)
longTP = close + (2 * atr) // TP = 2x ATR
longSL = close - (1.2 * atr) // SL = 1.2x ATR
shortTP = close - (2 * atr)
shortSL = close + (1.2 * atr)
// === Execute Trades ===
if validBullFVG
strategy.entry("Long", strategy.long)
strategy.exit("Long Exit", from_entry="Long", limit=longTP, stop=longSL)
if validBearFVG
strategy.entry("Short", strategy.short)
strategy.exit("Short Exit", from_entry="Short", limit=shortTP, stop=shortSL)
// === Plot Buy/Sell Signals ===
plotshape(series=validBullFVG, location=location.belowbar, color=color.green, style=shape.labelup, text="BUY", title="BUY Signal")
plotshape(series=validBearFVG, location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL", title="SELL Signal")
// Highlight Significant FVGs
bgcolor(validBullFVG ? color.new(color.green, 85) : na)
bgcolor(validBearFVG ? color.new(color.red, 85) : na)