Momentum Threshold-Driven Balance of Power Trading Strategy

BOP TA MA RSI THRESHOLD momentum LEVERAGE EQUITY
Created on: 2025-02-24 09:35:40 Modified on: 2025-02-27 16:50:22
Copy: 1 Number of hits: 368
avatar of ianzeng123 ianzeng123
2
Follow
319
Followers

 Momentum Threshold-Driven Balance of Power Trading Strategy  Momentum Threshold-Driven Balance of Power Trading Strategy

Overview

This strategy is a momentum-based trading system that utilizes the Balance of Power (BoP) indicator on a 4-hour timeframe. By measuring the strength between buyers and sellers, it triggers trading signals when the indicator crosses predetermined thresholds. The strategy includes dynamic position sizing, adjustable leverage, and visual trade tracking features, effectively capturing market trend reversal points.

Strategy Principles

The core mechanism calculates (Close-Open)/(High-Low) to measure market force balance. Values near 1 indicate strong bullish momentum, while values near -1 suggest strong bearish pressure. The trading logic includes: - Entry Condition: Long position when BoP crosses above 0.8, indicating strong buying pressure - Exit Condition: Close position when BoP crosses below -0.8, showing increased selling pressure - Position Management: Dynamic adjustment based on account equity with adjustable leverage

Strategy Advantages

  1. Clear Signals: Fixed thresholds prevent frequent trading and focus on high-confidence signals
  2. Controlled Risk: Flexible risk management through dynamic positioning and adjustable leverage
  3. Strong Visualization: Provides trade markers and historical records for strategy backtesting
  4. Good Adaptability: Suitable for volatile market conditions, capturing trend reversals effectively

Strategy Risks

  1. Slippage Risk: May face significant slippage during volatile periods
  2. False Breakout Risk: Potential losses from false breakthrough signals
  3. Trend Dependency: May underperform in ranging markets
  4. Leverage Risk: High leverage may lead to substantial losses

Optimization Directions

  1. Trend Filtering: Incorporate additional technical indicators for trend direction
  2. Threshold Optimization: Dynamically adjust thresholds based on market conditions
  3. Stop-Loss Enhancement: Add trailing stop-loss and other risk control measures
  4. Time Filtering: Consider important economic data releases and timing factors

Summary

The strategy captures market momentum changes through the Balance of Power indicator, combining dynamic position management and risk control to build a relatively complete trading system. While risks exist, continuous optimization can further enhance strategy stability and profitability. It’s suitable for traders interested in momentum trading research and implementation.

Strategy source code
/*backtest
start: 2024-02-25 00:00:00
end: 2025-02-22 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Binance","currency":"SOL_USDT"}]
*/

//@version=5
strategy(title="Balance of Power for US30 4H", format=format.price, precision=2, default_qty_type=strategy.percent_of_equity, default_qty_value=100, overlay=true, commission_value=0.01, max_labels_count=500, max_lines_count = 500)

leverage = input.float(5, "Leverage 1:", tooltip="Multiply your equity (100%) times the leverage.")

p = (close - open) / (high - low)
qty = strategy.equity * leverage / close

if ta.crossover(p, 0.8)
    strategy.entry("L", strategy.long, qty=qty)

if ta.crossunder(p, -0.8)
    strategy.close("L")

green   = color.new(#0097a7, 0)
red     = color.new(#ff195f, 0)
green90 = color.new(#0097a7, 85)
red90   = color.new(#ff195f, 85)

if strategy.position_size > strategy.position_size[1]
    label.new(bar_index, low * 0.999, text="▲", textcolor=green, size=size.normal, textalign=text.align_center, color=green90, style=label.style_text_outline)
    label.new(bar_index, low * 0.999, text="Buy", textcolor=green, size=size.tiny, textalign=text.align_center, color=green90, style=label.style_label_up)

if strategy.position_size < strategy.position_size[1]
    label.new(bar_index, high * 1.001, text="▼", textcolor=red, size=size.normal, textalign=text.align_center, color=red90, style=label.style_text_outline)
    label.new(bar_index, high * 1.001, text="Close", textcolor=red, size=size.tiny, textalign=text.align_center, color=red90, style=label.style_label_down)


var float tradeEntryPrice = na
var int   tradeEntryBar   = na

if strategy.position_size > 0 and strategy.position_size[1] == 0
    tradeEntryPrice := close
    tradeEntryBar   := bar_index


if strategy.position_size == 0 and strategy.position_size[1] > 0
    exitPrice = close
    exitBar   = bar_index
    tradeColor = (exitPrice - tradeEntryPrice > 0) ? green : red

    topPrice    = math.max(tradeEntryPrice, exitPrice)
    bottomPrice = math.min(tradeEntryPrice, exitPrice)

    box.new(tradeEntryBar, topPrice, exitBar, bottomPrice, border_width=0, bgcolor=color.new(tradeColor, 85))
    line.new(tradeEntryBar, topPrice, exitBar, topPrice, color=tradeColor, width=1)
    line.new(tradeEntryBar, bottomPrice, exitBar, bottomPrice, color=tradeColor, width=1)