Logo

dev-resources.site

for different kinds of informations.

Multi-Market Adaptive Multi-Indicator Trend Following Strategy

Published at
1/15/2025
Categories
strategy
trading
indicator
market
Author
fmzquant
Categories
4 categories in total
strategy
open
trading
open
indicator
open
market
open
Author
8 person written this
fmzquant
open
Multi-Market Adaptive Multi-Indicator Trend Following Strategy

Image description

Overview
This is an adaptive trend tracking strategy based on a combination of multiple technical indicators, which can automatically adjust parameters according to different market characteristics. The strategy uses the capital flow index (CMF), the detrended price oscillator (DPO) and the Coppock index to capture market trends, and adapts to the characteristics of different markets through the volatility adjustment factor. The strategy has a complete position management and risk control system, and can dynamically adjust the transaction size according to market volatility.

Strategy Principle
The core logic of the strategy is to confirm the trend direction and trading timing through the coordination of multiple indicators. Specifically:

  1. Use CMF indicators to measure capital flows and judge market sentiment
  2. Eliminate the impact of long-term trends through the DPO indicator and focus on short- and medium-term price fluctuations
  3. Using the modified Coppock indicator to capture trend turning points
  4. A trading signal is generated when all three indicators confirm
  5. Dynamically calculate stop loss and take profit positions through ATR
  6. Automatically adjust leverage and volatility parameters based on different market characteristics (stocks, foreign exchange, futures)

Strategy Advantages

  1. Multi-indicator cross-validation can effectively filter out false signals
  2. Strong adaptability, can be applied to different market environments
  3. Perfect position management system, dynamically adjust positions according to volatility
  4. It has a stop-loss and stop-profit mechanism to control risks while protecting profits
  5. Support multiple varieties of transactions at the same time to diversify risks
  6. The transaction logic is clear, easy to maintain and optimize

Strategy Risks

  1. Multi-indicator systems may have lags and miss opportunities in fast-moving markets
  2. Excessive parameter optimization may lead to overfitting
  3. Market switching periods may generate false signals
  4. Setting a stop loss too tight may lead to frequent stop losses
  5. Transaction costs can affect strategy returns.
  6. It is recommended to manage risk by:
  • Regularly check parameter validity
  • Real-time monitoring of position performance
  • Reasonable control of leverage ratio
  • Set a maximum drawdown limit

Strategy Optimization Direction

  1. Introduce market volatility status judgment and use different parameter combinations in different volatility environments
  2. Add more market feature identification indicators to improve strategy adaptability
  3. Optimize the stop loss and take profit mechanism, and consider using a moving stop loss
  4. Develop an automatic parameter optimization system to adjust parameters regularly
  5. Add transaction cost analysis module
  6. Add risk warning mechanism

Summary
This strategy is a relatively complete trend tracking system. Through the coordination of multiple indicators and risk control mechanisms, it can ensure returns while also controlling risks. The strategy is highly scalable and has a lot of room for optimization. It is recommended to start with a small scale in real trading and gradually increase the scale of transactions, while continuously monitoring the performance of the strategy and adjusting the parameters in a timely manner.

Strategy source code

/*backtest
start: 2019-12-23 08:00:00
end: 2024-12-10 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
strategy("Multi-Market Adaptive Trading Strategy", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=10)

// Input parameters
i_market_type = input.string("Crypto", "Market Type", options=["Forex", "Crypto", "Futures"])
i_risk_percent = input.float(1, "Risk Per Trade (%)", minval=0.1, maxval=100, step=0.1)
i_volatility_adjustment = input.float(1.0, "Volatility Adjustment", minval=0.1, maxval=5.0, step=0.1)
i_max_position_size = input.float(5.0, "Max Position Size (%)", minval=1.0, maxval=100.0, step=1.0)
i_max_open_trades = input.int(3, "Max Open Trades", minval=1, maxval=10)

// Indicator Parameters
i_cmf_length = input.int(20, "CMF Length", minval=1)
i_dpo_length = input.int(21, "DPO Length", minval=1)
i_coppock_short = input.int(11, "Coppock Short ROC", minval=1)
i_coppock_long = input.int(14, "Coppock Long ROC", minval=1)
i_coppock_wma = input.int(10, "Coppock WMA", minval=1)
i_atr_length = input.int(14, "ATR Length", minval=1)

// Market-specific Adjustments
volatility_factor = i_market_type == "Forex" ? 0.1 : i_market_type == "Futures" ? 1.5 : 1.0
volatility_factor *= i_volatility_adjustment
leverage = i_market_type == "Forex" ? 100.0 : i_market_type == "Futures" ? 20.0 : 3.0

// Calculate Indicators
mf_multiplier = ((close - low) - (high - close)) / (high - low)
mf_volume = mf_multiplier * volume
cmf = ta.sma(mf_volume, i_cmf_length) / ta.sma(volume, i_cmf_length)

dpo_offset = math.floor(i_dpo_length / 2) + 1
dpo = close - ta.sma(close, i_dpo_length)[dpo_offset]

roc1 = ta.roc(close, i_coppock_short)
roc2 = ta.roc(close, i_coppock_long)
coppock = ta.wma(roc1 + roc2, i_coppock_wma)

atr = ta.atr(i_atr_length)

// Define Entry Conditions
long_condition = cmf > 0 and dpo > 0 and coppock > 0 and ta.crossover(coppock, 0)
short_condition = cmf < 0 and dpo < 0 and coppock < 0 and ta.crossunder(coppock, 0)

// Calculate Position Size
account_size = strategy.equity
risk_amount = math.min(account_size * (i_risk_percent / 100), account_size * (i_max_position_size / 100))
position_size = (risk_amount / (atr * volatility_factor)) * leverage

// Execute Trades
if (long_condition and strategy.opentrades < i_max_open_trades)
    sl_price = close - (atr * 2 * volatility_factor)
    tp_price = close + (atr * 3 * volatility_factor)
    strategy.entry("Long", strategy.long, qty=position_size)
    strategy.exit("Long Exit", "Long", stop=sl_price, limit=tp_price)

if (short_condition and strategy.opentrades < i_max_open_trades)
    sl_price = close + (atr * 2 * volatility_factor)
    tp_price = close - (atr * 3 * volatility_factor)
    strategy.entry("Short", strategy.short, qty=position_size)
    strategy.exit("Short Exit", "Short", stop=sl_price, limit=tp_price)

// Plot Indicators
plot(cmf, color=color.blue, title="CMF")
plot(dpo, color=color.green, title="DPO")
plot(coppock, color=color.red, title="Coppock")
hline(0, "Zero Line", color=color.gray)

// Alerts
alertcondition(long_condition, title="Long Entry", message="Potential Long Entry Signal")
alertcondition(short_condition, title="Short Entry", message="Potential Short Entry Signal")

// // Performance reporting
// if barstate.islastconfirmedhistory
//     label.new(bar_index, high, text="Strategy Performance:\nTotal Trades: " + str.tostring(strategy.closedtrades) + 
//               "\nWin Rate: " + str.tostring(strategy.wintrades / strategy.closedtrades * 100, "#.##") + "%" +
//               "\nProfit Factor: " + str.tostring(strategy.grossprofit / strategy.grossloss, "#.##"))
Enter fullscreen mode Exit fullscreen mode

The original address: Multi-Market Adaptive Multi-Indicator Trend Following Strategy

strategy Article's
30 articles in total
Favicon
EMA-MACD Composite Strategy for Trend Scalping
Favicon
Dynamic Timing and Position Management Strategy Based on Volatility
Favicon
Multi-Market Adaptive Multi-Indicator Trend Following Strategy
Favicon
Multi-EMA Trend Following Strategy with SMMA Confirmation
Favicon
Multi-Indicator Trend Following Strategy with Bollinger Bands and ATR Dynamic Stop Loss
Favicon
Dynamic Pivot Points with Crossup Optimization System
Favicon
Multi-Timeframe Trend Dynamic ATR Tracking Strategy
Favicon
Multi-dimensional Gold Friday Anomaly Strategy Analysis System
Favicon
Mean Reversion Bollinger Band Dollar-Cost Averaging Investment Strategy
Favicon
First Principles - A Foundation for Groundbreaking Thinking
Favicon
Dynamic ATR Trend Following Strategy Based on Support Level Breakthrough
Favicon
Price Pattern Based Double Bottom and Top Automated Trading Strategy
Favicon
Multi-Indicator Adaptive Trading Strategy Based on RSI, MACD and Volume
Favicon
Multi-Moving Average Trend Following Strategy - Long-term Investment Signal System Based on EMA and SMA Indicators
Favicon
Dual EMA Crossover Strategy with Smart Risk-Reward Control
Favicon
Multi-Period EMA Crossover with RSI Momentum and ATR Volatility Based Trend Following Strategy
Favicon
Dual EMA Stochastic Trend Following Trading Strategy
Favicon
Multi-Wave Trend Crossing Risk Management Quantitative Strategy
Favicon
Dynamic EMA Trend Crossover Entry Quantitative Strategy
Favicon
Enhanced Mean Reversion Strategy with MACD-ATR Implementation
Favicon
Bollinger Bands Momentum Breakout Adaptive Trend Following Strategy
Favicon
Multi-Indicator Synergistic Trend Following Strategy with Dynamic Stop-Loss System
Favicon
Adaptive Range Trading System Based on Dual RSI Indicators
Favicon
Advanced Five-Day Cross-Analysis Strategy Based on RSI and MACD Integration
Favicon
Advanced Quantitative Trend Capture Strategy with Dynamic Range Filter
Favicon
Multi-Technical Indicator Trend Following Strategy with RSI Momentum Filter
Favicon
Advanced Trend Following Strategy with Adaptive Trailing Stop
Favicon
Multi-Timeframe Trend Following Strategy with ATR-Based Take Profit and Stop Loss
Favicon
Triple Supertrend and Bollinger Bands Multi-Indicator Trend Following Strategy
Favicon
Dual Moving Average Trend Following Strategy with Risk Management

Featured ones: