Strategy vault / Trend following
Advanced Quantitative Trading Multi Moving Average Crossover System with Volume Filter Strategy
This is a quantitative trading strategy based on multiple moving average crossovers combined with volume filtering. The strategy utilizes three different period moving averages (fast EMA, slow EMA, and trend SMA) as…

Overview
This is a quantitative trading strategy based on multiple moving average crossovers combined with volume filtering. The strategy utilizes three different period moving averages (fast EMA, slow EMA, and trend SMA) as core indicators, along with a volume filter to confirm signal validity. The strategy also integrates stop-loss and take-profit functions for effective risk control.
Strategy Principles
The strategy is based on several core elements:
- Uses 9-period and 21-period exponential moving averages (EMA) for crossover signals
- Incorporates a 50-period simple moving average (SMA) as a trend filter to ensure trade direction aligns with the main trend
- Uses 1.5 times the 20-period average volume as a volume filter condition
- Confirms signal validity through price breakouts combined with volume expansion
- Sets 1% stop-loss and 400% take-profit to control risk-reward ratio
Strategy Advantages
- Multiple confirmation mechanism: Greatly improves signal reliability through fast/slow MA crossover, trend line filtering, and volume confirmation
- Comprehensive risk control: Sets reasonable stop-loss and take-profit ratios for effective drawdown control
- Strong trend-following capability: Ensures trade direction aligns with main trend through long-term moving average filtering
- High signal quality: Volume filtering effectively prevents false breakouts
- Flexible parameters: All indicator parameters can be optimized for different market characteristics
Strategy Risks
- Sideways market risk: May generate frequent trading signals in range-bound markets, increasing transaction costs
- Slippage risk: May face significant slippage in low liquidity conditions
- False breakout risk: Despite volume filtering, false breakouts may still occur
- Parameter optimization risk: Over-optimization may lead to overfitting
- Market environment dependency: Strategy performs better in trending markets but may underperform in other market conditions
Strategy Optimization Directions
- Introduce volatility indicators: Consider adding ATR indicator for dynamic stop-loss adjustment
- Optimize volume filtering: Consider using relative volume instead of absolute volume as filtering condition
- Add trend strength confirmation: Introduce indicators like ADX to confirm trend strength
- Improve take-profit mechanism: Design dynamic take-profit to better secure profits
- Add time filtering: Avoid trading during low volatility periods
Summary
The strategy constructs a relatively comprehensive trading system through the combination of multiple technical indicators. Its core advantages lie in its multiple confirmation mechanisms and comprehensive risk control, but it still requires parameter optimization and strategy improvements based on actual market conditions. Through proper optimization and risk control, this strategy has the potential to achieve stable returns in trending markets.
Source Pine Script
/*backtest
start: 2024-02-22 00:00:00
end: 2024-12-17 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Binance","currency":"ETH_USDT"}]
*/
//@version=5
strategy("Optimized Moving Average Crossover Strategy with Volume Filter", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100)
// Inputs for Moving Averages
fastLength = input.int(9, title="Fast MA Length")
slowLength = input.int(21, title="Slow MA Length")
trendFilterLength = input.int(50, title="Trend Filter Length")
// Risk Management Inputs
stopLossPercent = input.float(1, title="Stop Loss (%)", step=0.1)
takeProfitPercent = input.float(400, title="Take Profit (%)", step=0.1)
// Volume Filter Input
volumeMultiplier = input.float(1.5, title="Volume Multiplier", step=0.1) // Multiplier for average volume
// Moving Averages
fastMA = ta.ema(close, fastLength)
slowMA = ta.ema(close, slowLength)
trendMA = ta.sma(close, trendFilterLength) // Long-term trend filter
// Volume Calculation
avgVolume = ta.sma(volume, 20) // 20-period average volume
volumeCondition = volume > avgVolume * volumeMultiplier // Volume must exceed threshold
// Plotting Moving Averages
plot(fastMA, color=color.blue, title="Fast MA")
plot(slowMA, color=color.red, title="Slow MA")
plot(trendMA, color=color.green, title="Trend Filter MA")
// Entry Conditions (Filtered by Trend and Volume)
longCondition = ta.crossover(fastMA, slowMA) and close > trendMA and volumeCondition
shortCondition = ta.crossunder(fastMA, slowMA) and close < trendMA and volumeCondition
// Execute Trades
if (longCondition)
strategy.entry("Long", strategy.long)
if (shortCondition)
strategy.entry("Short", strategy.short)
// Exit Conditions: Stop Loss and Take Profit
if (strategy.position_size > 0)
strategy.exit("Exit Long", "Long", stop=strategy.position_avg_price * (1 - stopLossPercent / 100), limit=strategy.position_avg_price * (1 + takeProfitPercent / 100))
if (strategy.position_size < 0)
strategy.exit("Exit Short", "Short", stop=strategy.position_avg_price * (1 + stopLossPercent / 100), limit=strategy.position_avg_price * (1 - takeProfitPercent / 100))
// Additional Alerts
alertcondition(longCondition, title="Long Signal", message="Go Long!")
alertcondition(shortCondition, title="Short Signal", message="Go Short!")
// Debugging Labels
if (longCondition)
label.new(bar_index, close, "Long", style=label.style_label_up, color=color.green, textcolor=color.white)
if (shortCondition)
label.new(bar_index, close, "Short", style=label.style_label_down, color=color.red, textcolor=color.white)Published by ianzeng123 on the FMZ strategy square · last modified 2025-02-21. 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.
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/Advanced-Quantitative-Trading-Multi-Moving-Average-Crossover-System-with-Volume-Filter-Strategy.md- npx agenkit install engineering-kit in your project
- Paste the command into your agent and approve each phase
- 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
- Multi Factor Trend Price Action Strategy with Dynamic Risk Management SystemPine Script · Trend following · 2h
- DPO EMA Trend Crossover Quantitative Strategy ResearchPine Script · Trend following · 1d
- Dual EMA Crossover Trend Following Strategy with ATR and ADX FiltersPine Script · Trend following · 1d
- Advanced Multi Indicator Trend Confirmation Trading StrategyPine Script · Trend following · 1d
- Multi Factor Trend Tracking Dynamic Risk Management Stock Trading StrategyPine Script · Trend following · 1d
- Multi Timeframe Volume and Trend Confluence Trading StrategyPine Script · Trend following · 1d