This strategy is a comprehensive trading system that combines multi-timeframe analysis, Fair Value Gap (FVG), and Break of Structure (BOS). It identifies potential trading entries by detecting structure breakouts on higher timeframes while looking for fair value gap opportunities on lower timeframes. The strategy also incorporates a risk management system with automated stop-loss and take-profit settings.
The core logic is built on three main pillars: First, it uses a higher timeframe (default 1 hour or above) to identify Break of Structure (BOS), which provides the foundational framework for trading direction. Second, it looks for Fair Value Gaps (FVG) on lower timeframes, indicating potential supply-demand imbalances in those areas. Finally, it combines these conditions with current price position to trigger trading signals when price is in favorable locations. The system manages risk through risk-reward ratios and stop-loss factors.
This strategy constructs a complete trading system through the comprehensive use of multi-timeframe analysis, price structure breakouts, and fair value gaps. Its strengths lie in its multi-dimensional analysis approach and comprehensive risk management mechanisms, but traders still need to optimize parameters and control risks according to actual market conditions. Further optimization can focus on signal confirmation, dynamic parameter adjustment, and market environment filtering to further improve strategy stability and reliability.
/*backtest start: 2024-01-17 00:00:00 end: 2025-01-15 08:00:00 period: 1d basePeriod: 1d exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT","balance":49999}] */ //@version=5 strategy("ICT Strategy with Historical Backtest", overlay=true) // === Настройки === tf = input.timeframe("60", title="Higher Timeframe (1H or above)") // Таймфрейм для анализа BOS fvg_length = input(3, title="FVG Lookback Length") // Длина для поиска FVG risk_reward = input(2, title="Risk-Reward Ratio") // Риск-вознаграждение show_fvg_boxes = input(true, title="Show FVG Boxes") // Показывать FVG stop_loss_factor = input.float(1.0, title="Stop Loss Factor") // Множитель для стоп-лосса // === Переменные для анализа === var float bos_high = na var float bos_low = na // Получаем данные с более старшего таймфрейма htf_high = request.security(syminfo.tickerid, tf, high) htf_low = request.security(syminfo.tickerid, tf, low) htf_close = request.security(syminfo.tickerid, tf, close) // Определение BOS (Break of Structure) на старшем таймфрейме bos_up = ta.highest(htf_high, fvg_length) > ta.highest(htf_high[1], fvg_length) bos_down = ta.lowest(htf_low, fvg_length) < ta.lowest(htf_low[1], fvg_length) // Обновляем уровни BOS if (bos_up) bos_high := ta.highest(htf_high, fvg_length) if (bos_down) bos_low := ta.lowest(htf_low, fvg_length) // === Определение FVG (Fair Value Gap) === fvg_up = low > high[1] and low[1] > high[2] fvg_down = high < low[1] and high[1] < low[2] // Визуализация FVG (Fair Value Gap) // if (show_fvg_boxes) // if (fvg_up) // box.new(left=bar_index[1], top=high[1], right=bar_index, bottom=low, bgcolor=color.new(color.green, 90), border_color=color.green) // if (fvg_down) // box.new(left=bar_index[1], top=high, right=bar_index, bottom=low[1], bgcolor=color.new(color.red, 90), border_color=color.red) // === Логика сделок === // Условия для входа в Лонг long_condition = bos_up and fvg_up and close < bos_high if (long_condition) strategy.entry("Long", strategy.long, stop=low * stop_loss_factor, limit=low + (high - low) * risk_reward) // Условия для входа в Шорт short_condition = bos_down and fvg_down and close > bos_low if (short_condition) strategy.entry("Short", strategy.short, stop=high * stop_loss_factor, limit=high - (high - low) * risk_reward) // === Надписи для прогнозируемых сделок === if (long_condition) label.new(bar_index, low, text="Potential Long", color=color.green, style=label.style_label_up, textcolor=color.white, size=size.small) if (short_condition) label.new(bar_index, high, text="Potential Short", color=color.red, style=label.style_label_down, textcolor=color.white, size=size.small)