Dual Moving Average Price Channel Trading Strategy

Author: ChaoZhang, Date: 2024-01-19 16:44:31



The Dual Moving Average Price Channel Trading Strategy is a quantitative trading strategy that integrates the Price Channel indicator and Moving Average indicator. The strategy judges the direction of the price channel by constructing a price channel and uses the moving average to determine the price trend to generate trading signals.

Strategy Logic

The core principle of the Dual Moving Average Price Channel Trading Strategy is:

  1. Construct the price ceiling and price floor to form a price channel. A breakout above the ceiling is a bullish signal and a breakout below the floor is a bearish signal.

  2. Calculate the moving average. When the price is above the moving average, it is a bullish trend. When the price is below the moving average, it is a bearish trend.

  3. By combining the Price Channel indicator and the Moving Average indicator, more reliable trading signals can be generated. The specific rules are:

    • Buy signal: Price breaks out the floor and is below the moving average, go long.
    • Sell signal: Price breaks out the ceiling and is above the moving average, go short.

The strategy takes into account both the Price Channel and the Moving Average indicators to better judge the market trend and filter out false signals, making it relatively stable.

Advantage Analysis

The Dual Moving Average Price Channel Trading Strategy has the following advantages:

  1. Combining two indicators reduces false signals and makes trading signals more reliable.

  2. Using the price channel to judge the price action and the moving average to determine the price trend, the two indicators verify each other and are more accurate.

  3. The parameterization design allows the adjustment of the moving average length and price channel length through parameters to adapt to different products and frequencies.

  4. The strategy signal is relatively stable without signal oscillations, thus lowering trading risk.

  5. The strategy logic is simple and clear, easy to understand, and easy to implement for live trading.

  6. The strategy is completely indicator-based, requires no training, has zero data dependence, and is suitable for various products and frequencies.

Risk Analysis

The Dual Moving Average Price Channel Trading Strategy also has some risks:

  1. The strategy may miss opportunities when prices break out the channel rapidly, unable to capture short-term trends.

  2. When prices oscillate around the channel, trading signals may be triggered frequently, increasing trading frequency.

  3. Improper parameter settings of the price channel can increase risks when price fluctuations of futures are violent.

  4. The lack of a stop loss mechanism leads to inability to effectively control risks when losses expand.

The corresponding solutions are:

  1. Shorten the moving average period to make the strategy more sensitive to capture short-term trends.

  2. Increase the price channel length parameter to reduce false signals. Also, relax the entry criteria appropriately to control trading frequency.

  3. Optimize parameters through backtesting to find the best price channel settings.

  4. Add a moving stop loss logic to reduce losses per trade.


There is room for further optimization of the Dual Moving Average Price Channel Trading Strategy:

  1. Other indicators like MACD and KDJ can be combined with the entry criteria for multi-indicator filtering and more stable signals.

  2. Different parameters can be tested for their impact on strategy performance to find the optimal parameter combination, e.g. testing different moving average periods.

  3. A dynamic stop loss module can be added. When the losses reach a certain level, the position can be closed by stop loss to effectively control risks.

  4. Machine learning models can also be introduced, using historical data to train and optimize the strategy parameters for dynamic adjustment.

  5. A more complex improvement is to use deep learning algorithms to extract features and judge signals, replacing traditional indicators with neural networks to make the strategy intelligent.


The Dual Moving Average Price Channel Trading Strategy forms relatively stable and reliable trading signals through dual-indicator judgments. Also, the parameterized design allows flexible adjustments to suit different products. Integrating the advantages of price channels and moving averages, the strategy is relatively simple and practical for live trading. Certainly, there are still rooms for improvement such as entry criteria, stop loss, parameter optimization, and strategy intelligence.

start: 2024-01-11 00:00:00
end: 2024-01-18 00:00:00
period: 1m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]

// This Pine Scriptâ„¢ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © paparegier

strategy("G-Channel and EMA Strategy", shorttitle="GEMA", overlay=true)

// G-Channel Indicator
length = input(100)
a = 0.0
b = 0.0
a := na(a[1]) ? close : max(close, a[1]) - (a[1] - b[1]) / length
b := na(b[1]) ? close : min(close, b[1]) + (a[1] - b[1]) / length
avg = avg(a, b)

crossup = b[1] < close[1] and b > close
crossdn = a[1] < close[1] and a > close
bullish = barssince(crossdn) <= barssince(crossup)

// EMA Indicator
emaLength = input(20, title="EMA Length")
emaValue = ema(close, emaLength)

// Strategy Conditions
buyCondition = bullish and close < emaValue
sellCondition = not bullish and close > emaValue

// Execute Strategy
strategy.entry("Buy", strategy.long, when=buyCondition)
strategy.entry("Sell", strategy.short, when=sellCondition)

// Plotting
plot(avg, color=color.new(bullish ? color.lime : color.red, 90), linewidth=1, title="G-Channel Average")
plot(emaValue, color=color.rgb(0, 0, 255, 90), linewidth=1, title="EMA")

// Mark Buy and Sell Signals
plotshape(series=buyCondition, title="Buy Signal", color=color.green, style=shape.labelup, text="Buy", size=size.small)
plotshape(series=sellCondition, title="Sell Signal", color=color.red, style=shape.labeldown, text="Sell", size=size.small)