0bps

Strategy vault / Trend following

Triple EMA and Triple RMA Adaptive Channel Crossover Strategy

The Triple EMA and Triple RMA Adaptive Channel Crossover Strategy is a quantitative trading system that combines short-period EMA (Exponential Moving Average) and RMA (Relative Moving Average) indicators. This…

Author
ianzeng123
Complexity
Starter · 78 lines
Parameters
0
Backtest bar
1d · swing
Tested on
ETH/USDT · futures

IMG IMG

Overview

The Triple EMA and Triple RMA Adaptive Channel Crossover Strategy is a quantitative trading system that combines short-period EMA (Exponential Moving Average) and RMA (Relative Moving Average) indicators. This strategy utilizes the ATR (Average True Range) indicator to construct price channels and identifies entry signals by capturing price breakouts from these channels. The strategy incorporates a built-in risk management mechanism, calculating position size based on a fixed risk percentage, using the opening price as a stop-loss point, and designing a closing mechanism based on the previous period's opening price, forming a complete trading system.

Strategy Principles

The core logic of this strategy is based on two sets of moving averages combined with their ATR channels:

  1. EMA Channel System:

    • Uses a 3-period EMA as the center line
    • Constructs upper and lower channel boundaries by multiplying ATR by a factor of 1.5
    • Generates long signals when price breaks through the upper band; short signals when it breaks through the lower band
  2. RMA Channel System:

    • Uses a 3-period RMA as the center line
    • Constructs upper and lower channel boundaries by multiplying ATR by a factor of 1.0
    • Similarly generates trading signals through channel breakouts
  3. Signal Triggering Conditions:

    • Long entry triggered when closing price breaks above either channel's upper band
    • Short entry triggered when closing price breaks below either channel's lower band
    • Signals are only valid after bar confirmation (barstate.isconfirmed)
  4. Position Management:

    • Uses a fixed risk percentage method (0.5%) to calculate position size
    • The distance between entry price and stop-loss price determines the final position size
  5. Stop-Loss and Exit Mechanism:

    • Immediately sets a stop-loss order at the opening price upon entry
    • Closes long positions when the low crosses above the previous period's opening price
    • Closes short positions when the high crosses below the previous period's opening price

Strategy Advantages

  1. Rapid Response to Market Changes: Using ultra-short period (3) moving averages, the strategy can quickly capture price movements and enter trends in a timely manner.

  2. Dual Confirmation Mechanism: EMA and RMA systems work together, significantly improving trading reliability when both emit signals in the same direction.

  3. Adaptive Volatility Adjustment: By adjusting channel width through the ATR indicator, the strategy can automatically adjust sensitivity in different volatility environments.

  4. Precise Risk Control: Each trade risks a fixed 0.5% of account equity, strictly controlling single trade risk exposure.

  5. Clear Exit Strategy: The closing mechanism based on the previous period's opening price provides clear profit-taking conditions for trades.

  6. Differentiated Channel Multipliers: The EMA channel uses 1.5x ATR, while the RMA channel uses 1.0x ATR. This design gives the two systems different sensitivities, capable of capturing different types of market opportunities.

Strategy Risks

  1. Overtrading Risk: Ultra-short period (3) moving averages may generate too many false signals in oscillating markets, leading to frequent trading and commission erosion.

    • Solution: Consider adding confirmation filters, such as volume confirmation or trend direction filtering.
  2. Fixed Stop-Loss Setting: Using the opening price as a stop-loss point may not always be optimal, especially in high-volatility or gap markets.

    • Solution: Dynamically adjust stop-loss distance based on ATR or volatility percentage.
  3. Simplistic Exit Conditions: Relying solely on crosses of the previous period's opening price may lead to premature exits in strong trends.

    • Solution: Consider introducing trend strength indicators and adopting more relaxed exit conditions in strong trends.
  4. Lack of Market Environment Filtering: The strategy does not distinguish between different market states (trending/oscillating), potentially trading frequently in unsuitable market environments.

    • Solution: Add market state judgment indicators, such as ADX or volatility indicators, to pause trading in oscillating markets.
  5. Parameter Optimization Risk: Current parameters (such as period 3 and ATR multipliers) may be overfitted to historical data, with uncertain future performance.

    • Solution: Conduct parameter robustness testing and validate parameter stability using walk-forward optimization methods.

Strategy Optimization Directions

  1. Market State Adaptability Optimization:

    • Add market environment recognition mechanisms, such as ADX or volatility range judgment
    • Use different parameter settings or trading rules in different market states
    • This can avoid overtrading problems in oscillating markets
  2. Multi-Timeframe Confirmation:

    • Introduce longer-period (e.g., daily) trend judgment
    • Only trade when short-period signals align with long-period trend direction
    • This will improve signal reliability and reduce counter-trend trading
  3. Dynamic Stop-Loss Optimization:

    • Dynamically set stop-loss distances based on current ATR values
    • Give prices more breathing room in high-volatility environments
    • This method can better adapt to volatility characteristics in different market conditions
  4. Enhanced Exit Strategy:

    • Introduce trailing stop or trailing stop-loss mechanisms
    • Dynamically adjust exit strategies based on accumulated profits
    • This can better protect existing profits and allow trends to fully develop
  5. Signal Quality Assessment:

    • Develop a signal strength scoring system
    • Dynamically adjust position size based on signal quality
    • This will increase positions under high-confidence conditions and reduce risk under low-confidence conditions

Summary

The Triple EMA and Triple RMA Adaptive Channel Crossover Strategy cleverly combines two different types of moving averages with ATR channels, forming a trading system that is sensitive to price breakouts while maintaining risk control capabilities. This strategy is particularly suitable for capturing short-term price movements and responds quickly to rapidly developing trends. Through position management with fixed risk percentages and clear stop-loss strategies, the system focuses on capital safety while pursuing returns.

However, the strategy also faces potential overtrading risks and market environment adaptability issues. By adding market state filtering, optimizing stop-loss mechanisms, introducing multi-timeframe confirmation, and other methods, the robustness and long-term performance of this strategy can be significantly enhanced. In particular, adding the ability to recognize market environments will enable the strategy to selectively participate in trading under different market conditions, further improving its practicality and profitability.

Overall, this is a clearly structured, logically rigorous quantitative trading strategy with a solid theoretical foundation and application potential. Through the optimization directions suggested in this article, the strategy is expected to demonstrate stronger adaptability and stability across various market environments.

Source Pine Script

/*backtest
start: 2024-04-07 00:00:00
end: 2025-04-06 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"ETH_USDT"}]
*/

//@version=5
strategy("EMA3 & RMA3 ATR Strategy", overlay=true, initial_capital=10000, currency=currency.USD)

// -- Input Parameters --
ema_len = input.int(3, "EMAtimeframe")
ema_mult = input.float(1.5, "EMAChannelATRMultiplier", step=0.1)
rma_len = input.int(3, "RMAtimeframe")
rma_mult = input.float(1.0, "RMAChannelATRMultiplier", step=0.1)
atr_len = input.int(3, "ATRtimeframe")

// -- Core Computing --
ema_val = ta.ema(close, ema_len)
atr_val = ta.atr(atr_len)
ema_upper = ema_val + atr_val * ema_mult
ema_lower = ema_val - atr_val * ema_mult

rma_val = ta.rma(close, rma_len)
rma_upper = rma_val + atr_val * rma_mult
rma_lower = rma_val - atr_val * rma_mult

// -- Signal Conditions --
ema_buy = barstate.isconfirmed and close > ema_upper
ema_sell = barstate.isconfirmed and close < ema_lower
rma_buy = barstate.isconfirmed and close > rma_upper
rma_sell = barstate.isconfirmed and close < rma_lower

// -- Position Calculation --
risk_percent = 0.5 // Single Trade Risk0.5%
position_size(price, stop_price) => 
    risk_amount = strategy.equity * risk_percent / 100
    math.abs(price - stop_price) > 0 ? (risk_amount / math.abs(price - stop_price)) : na

// -- Transaction logic --
var float prev_open = na
if barstate.isconfirmed
    prev_open := open[1]

// Long Trade Logic
if (ema_buy or rma_buy) and strategy.position_size == 0
    stop_price = open
    qty = position_size(close, stop_price)
    if not na(qty)
        strategy.entry("Long", strategy.long, qty=qty)
        strategy.exit("Long Stop", "Long", stop=stop_price)

// Short Trade Logic
if (ema_sell or rma_sell) and strategy.position_size == 0
    stop_price = open
    qty = position_size(close, stop_price)
    if not na(qty)
        strategy.entry("Short", strategy.short, qty=qty)
        strategy.exit("Short Stop", "Short", stop=stop_price)

// Close Position Logic
if strategy.position_size > 0
    if ta.crossover(low, prev_open)
        strategy.close("Long")

if strategy.position_size < 0
    if ta.crossunder(high, prev_open)
        strategy.close("Short")

// -- Visualization --
plot(ema_val, "EMA3", color.new(#00BFFF, 0), 2)
plot(ema_upper, "EMA Upper", color.red, 1)
plot(ema_lower, "EMA Lower", color.green, 1)
plot(rma_val, "RMA3", color.new(#FFA500, 0), 2)
plot(rma_upper, "RMA Upper", #FF1493, 1)
plot(rma_lower, "RMA Lower", #32CD32, 1)

Published by ianzeng123 on the FMZ strategy square · last modified 2025-04-07. Collected in the Quant Trading Vault. Unvalidated research: re-test with your own data and costs before trusting it.

Build this with AgenKit

A spec is not a trading system. Paste this into your coding agent and AgenKit runs a specialist team — architecture, test-first build, risk gates, review — with paper trading on by default.

in Claude Code, Cursor, Codex & 4 more
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/Triple-EMA-and-Triple-RMA-Adaptive-Channel-Crossover-Strategy.md
  1. npx agenkit install engineering-kit in your project
  2. Paste the command into your agent and approve each phase
  3. Get tests, backtest, risk controls and a paper-trading switch

Understand it first

Before you run this, read the lesson behind the idea and how to backtest it honestly. Specs like this one are the survivors of an unknown number of trials; deflate their results accordingly.

Related specs

esc

Try , , or .

↑↓ move↵ open