
The Multi-Dimensional Entropy Momentum Trend Adaptive Trading System is a quantitative trading strategy based on entropy theory, centered around the CETP-Plus indicator, which measures “orderliness” in candle patterns using Shannon entropy. This system integrates the recent weighting principle of Exponential Moving Average (EMA), momentum bias of Relative Strength Index (RSI), volatility scaling of Average True Range (ATR), and trend strength of Average Directional Index (ADX) into a single score. This unique approach avoids the complexity of layering multiple indicators while improving the accuracy of early trend detection and balancing long/short trades. CETP-Plus calculates entropy values (low entropy = strong pattern) by binning candle ratios (body, upper/lower wicks) into a 3D histogram, and adjusts the score with momentum, volatility, and trend multipliers to generate robust signals. Entries are triggered when scores exceed thresholds (positive for longs, negative for shorts), with exits on reversals or stops. The strategy is fully automated, requires no manual bias, and is optimized for margin accounts with equal treatment of long and short trades.
The core principle of this strategy is applying Shannon entropy to financial market candle pattern analysis. Shannon entropy, derived from information theory, quantifies the uncertainty or “chaos” of a random variable. In this strategy, entropy is calculated and applied through:
The final CETP score is a composite product of these factors, with positive values leaning bullish and negative values bearish. The trading logic is straightforward: go long when CETP score exceeds a positive threshold, go short when below a negative threshold. To avoid tiny trades, a minimum price move filter ensures the current candle has sufficient range before triggering a trade. Risk management is implemented through percentage stop-losses, ATR multipliers, and trailing stops.
Integrated Signaling: The CETP-Plus indicator fuses the advantages of multiple traditional indicators (EMA, RSI, ATR, ADX), providing a single, clear trading signal that avoids indicator conflicts and overfitting risks.
Strong Adaptability: The strategy automatically adjusts to market conditions, adapting to different volatility environments and trend strengths, performing well across various market states without manual intervention.
Symmetrical Long/Short Treatment: The strategy gives equal weight to long and short opportunities, making it effective in both bull and bear markets without directional bias.
Early Trend Identification: By capturing market structure changes through entropy, the strategy can identify early trend formation before traditional indicators, providing better entry timing.
Reduced Noise Impact: Through entropy analysis and histogram binning techniques, the strategy can distinguish between real signals and market noise, reducing false signals.
Customizability: Numerous parameters can be optimized for different trading instruments and timeframes, giving the strategy high flexibility and adaptability.
Comprehensive Risk Management: Integrated multi-level risk control mechanisms, including percentage stop-losses, ATR-based dynamic stops, trailing stops, and minimum trade filters effectively control drawdowns.
Parameter Sensitivity: The strategy includes multiple adjustable parameters; over-optimization may lead to poor performance in live trading. Different market environments may require different parameter settings, complicating system maintenance.
High-Frequency Trading Risks: The strategy may generate numerous trading signals, especially in volatile markets, leading to overtrading, increased commission costs, and amplified slippage.
Computational Complexity: 3D histogram binning and entropy calculations may require significant computational resources when executed in real-time, potentially causing execution delays, especially on shorter timeframes.
Algorithmic Assumption Risk: The strategy is based on the assumption that entropy can effectively capture market patterns, but market structures may change over time, invalidating this assumption.
Volatility Dependence: The strategy uses volatility filters and minimum price move filters, potentially missing trading opportunities in low-volatility environments and being overly sensitive in high-volatility environments.
Historical Fitting Risk: Despite combining multiple indicator advantages, there remains a risk of overfitting to historical data, with potential performance decline when future market conditions change.
Solutions include: regularly re-optimizing parameters, using walk-forward testing to validate parameter robustness, implementing stricter filtering conditions to reduce trading frequency, adding confirmation conditions to improve signal quality, and real-time monitoring of system performance to adjust risk parameters.
Adaptive Parameter Mechanism: Implement dynamic adjustment of parameters, automatically optimizing CETP window, thresholds, and weights based on market volatility, volume, and trend strength. This optimization can help the system better adapt to changing market conditions and reduce the need for manual intervention.
Multi-Timeframe Analysis Integration: Integrate CETP signals from different timeframes to create a hierarchical confirmation system. For example, execute trades only when higher timeframe signals align with trading timeframe signals, improving win rates.
Machine Learning Enhancement: Introduce machine learning algorithms to optimize parameter selection and signal filtering. Use supervised learning to identify best-performing parameter combinations, or clustering algorithms to identify different market states and adjust the strategy accordingly.
Liquidity and Volume Filters: Add filters based on trading volume and market depth to ensure trades are executed only when liquidity is sufficient, reducing slippage and execution risks.
Multi-Asset Correlation Analysis: Incorporate information from related markets (like indices, correlated stocks, or commodities), enhancing trade confidence when multiple related markets show consistent signals.
Volatility Prediction Model: Develop a volatility prediction component to adjust thresholds and risk parameters in advance, preparing for upcoming volatility environments.
Automated Backtesting and Optimization Framework: Establish an automated system to regularly backtest the strategy on new data and adjust parameters based on the latest market behavior, ensuring the strategy maintains adaptability.
These optimization directions aim to enhance the strategy’s robustness, adaptability, and profitability while reducing the need for human intervention and overfitting risk. By implementing these optimizations incrementally, a more intelligent and autonomous trading system can be built.
The Multi-Dimensional Entropy Momentum Trend Adaptive Trading System represents an innovative approach to quantitative trading by applying the concept of entropy from information theory to financial markets, capturing orderliness and predictability in price patterns. The core strength of this strategy lies in its integration of mathematical principles from multiple traditional technical indicators to create a single, clear trading signal, avoiding indicator conflicts and signal confusion. The CETP-Plus indicator, through 3D histogram binning and entropy calculation, combined with momentum bias, trend strength, and volatility adjustments, provides early trend identification and balanced long/short trading opportunities.
While the strategy features strong adaptability and risk management capabilities, it also faces challenges such as parameter sensitivity, computational complexity, and market structure changes. By implementing the suggested optimization directions, such as adaptive parameter mechanisms, multi-timeframe analysis, and machine learning enhancements, the strategy’s robustness and long-term performance can be further improved.
Overall, this is a theoretically sound and elegantly designed quantitative trading system suitable for traders with programming and statistical backgrounds to apply in higher volatility markets. With careful parameter optimization and ongoing system monitoring, the strategy has the potential to generate consistent risk-adjusted returns across various market environments.
/*backtest
start: 2024-08-11 00:00:00
end: 2025-08-09 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"ETH_USDT"}]
*/
// @version=6
strategy("Canuck Trading Traders Strategy [Candle Entropy Edition]", overlay=true, default_qty_value = 10)
// Note: Set Properties "Order size" to "100% of equity" for equity-based sizing or fixed contracts (e.g., 100).
// === CETP-Plus Settings ===
cetp_window = input.int(5, "CETP Window", minval=1, maxval=20, group="CETP-Plus Settings")
cetp_bins = input.int(3, "CETP Bins per Dimension", minval=1, maxval=10, group="CETP-Plus Settings")
long_threshold = input.float(0.1, "Long Threshold", minval=0.01, maxval=5.0, step=0.01, group="CETP-Plus Settings")
short_threshold = input.float(-0.1, "Short Threshold", minval=-0.8, maxval=-0.01, step=0.01, group="CETP-Plus Settings")
cetp_k = input.float(0.8, "CETP Momentum Weight", minval=0.1, maxval=5.0, step=0.1, group="CETP-Plus Settings")
mom_scale = input.float(6.0, "Momentum Scale", minval=1.0, maxval=20.0, step=1.0, group="CETP-Plus Settings")
body_weight = input.float(1.0, "Body Ratio Weight", minval=0.0, maxval=2.0, step=0.1, group="CETP-Plus Settings")
upper_weight = input.float(0.8, "Upper Wick Ratio Weight", minval=0.0, maxval=2.0, step=0.1, group="CETP-Plus Settings")
lower_weight = input.float(1.0, "Lower Wick Ratio Weight", minval=0.0, maxval=2.0, step=0.1, group="CETP-Plus Settings")
decay_factor = 0.8 // Hardcoded decay for exponential weighting (recent candles weighted more)
// === Trade Settings ===
min_score_strength = input.float(0.03, "Min CETP Score Strength", minval=0.0, maxval=5, step=0.01, group="Trade Settings")
stop_loss_pct = input.float(0.5, "Stop Loss (%)", minval=0.1, maxval=5.0, step=0.1, group="Trade Settings")
atr_mult = input.float(3.0, "ATR Multiplier", minval=0.5, maxval=10.0, step=0.1, group="Trade Settings")
trail_mult = input.float(5.0, "Trailing ATR Mult", minval=0.5, maxval=10.0, step=0.1, group="Trade Settings")
trail_offset_pct = input.float(1.0, "Trail Start Offset (%)", minval=0.5, maxval=10.0, step=0.1, group="Trade Settings")
min_price_move_mult = input.float(2.0, "Min Price Move ATR Mult (to avoid tiny trades)", minval=0.5, maxval=10.0, step=0.1, group="Trade Settings") // Filter tiny moves
// Indicators (ATR for stops/trails only)
atr = nz(ta.atr(14), 0.0)
// Volatility Filter (CV < 15% to avoid chop)
vol_threshold = ta.stdev(close, 20) / ta.sma(close, 20) * 100
trade_allowed = vol_threshold < 15.0
// Minimum Price Move Filter (candle range > ATR multiple, floored by min tick)
min_price_move = math.max(atr * min_price_move_mult, syminfo.mintick * 10) // Avoid sub-penny moves; 10x tick for robustness
price_move_condition = (high - low) > min_price_move // Fixed: Use high - low instead of ta.range()
// CETP-Plus Calculation (Blended EMA, RSI, ATR, ADX theses)
epsilon = 1e-5
body_ratio = (close - open) / (high - low + epsilon) * body_weight
upper_wick_ratio = (high - math.max(open, close)) / (high - low + epsilon) * upper_weight
lower_wick_ratio = (math.min(open, close) - low) / (high - low + epsilon) * lower_weight
// EMA-like weighting: Exponentially weight recent candles with fixed-size rolling arrays
var float[] body_arr = array.new_float(cetp_window, 0.0)
var float[] upper_arr = array.new_float(cetp_window, 0.0)
var float[] lower_arr = array.new_float(cetp_window, 0.0)
// Shift and decay older values, add new at the end
for i = 0 to cetp_window - 2
array.set(body_arr, i, array.get(body_arr, i + 1) * decay_factor)
array.set(upper_arr, i, array.get(upper_arr, i + 1) * decay_factor)
array.set(lower_arr, i, array.get(lower_arr, i + 1) * decay_factor)
array.set(body_arr, cetp_window - 1, body_ratio)
array.set(upper_arr, cetp_window - 1, upper_wick_ratio)
array.set(lower_arr, cetp_window - 1, lower_wick_ratio)
// Volatility scaling (ATR thesis)
bin_size = 2.0 / cetp_bins * (1 + atr / ta.sma(atr, 14))
hist_size = cetp_bins * cetp_bins * cetp_bins
var int[] hist = array.new_int(hist_size, 0)
array.fill(hist, 0)
for i = 0 to cetp_window - 1
body_val = array.get(body_arr, i)
upper_val = array.get(upper_arr, i)
lower_val = array.get(lower_arr, i)
body_bin = math.max(0, math.min(cetp_bins - 1, math.floor((body_val + 1) / bin_size)))
upper_bin = math.max(0, math.min(cetp_bins - 1, math.floor((upper_val + 1) / bin_size)))
lower_bin = math.max(0, math.min(cetp_bins - 1, math.floor((lower_val + 1) / bin_size)))
bin_idx = body_bin * (cetp_bins * cetp_bins) + upper_bin * cetp_bins + lower_bin
array.set(hist, bin_idx, array.get(hist, bin_idx) + 1)
entropy = 0.0
for i = 0 to hist_size - 1
count = array.get(hist, i)
p = count / cetp_window
if p > 0
entropy := entropy - p * math.log(p)
max_entropy = math.log(hist_size)
norm_entropy = max_entropy > 0 ? entropy / max_entropy : 0.0
// RSI-like momentum bias
avg_gain = ta.rma(math.max(close - close[1], 0), cetp_window)
avg_loss = ta.rma(math.max(close[1] - close, 0), cetp_window)
rsi_bias = avg_loss > 0 ? avg_gain / avg_loss : 1.0
momentum = ta.mom(close, cetp_window) / (close[cetp_window] != 0 ? close[cetp_window] : 1e-5)
momentum_adj = momentum * (1 + rsi_bias)
// ADX-like trend strength (automated and symmetric for bull/bear)
di_plus = ta.rma(math.max(high - high[1], 0), cetp_window) / atr
di_minus = ta.rma(math.max(low[1] - low, 0), cetp_window) / atr
trend_strength = di_plus > di_minus ? 1.2 : (di_minus > di_plus ? 1.2 : 1.0)
// CETP-Plus Score (optimized: no abs on momentum_adj to preserve sign for better short detection)
avg_body = nz(array.avg(body_arr), 0.0)
raw_score = avg_body * (1 - norm_entropy) * (cetp_k + momentum_adj * mom_scale)
cetp_score = nz(raw_score * trend_strength, 0.0)
// Position State
var float entry_price = na
var int bars_held = 0
if barstate.isconfirmed
bars_held := strategy.position_size != 0 ? bars_held + 1 : 0
// Trade Logic: Rely solely on current CETP score for entries/exits/reversals, with min price move filter
if bar_index >= cetp_window and math.abs(cetp_score) > min_score_strength and trade_allowed and price_move_condition
if cetp_score > long_threshold
if strategy.position_size < 0
strategy.close("Short", comment="Reverse to Long")
if strategy.position_size <= 0
strategy.entry("Long", strategy.long)
entry_price := close
sl = entry_price * (1 - stop_loss_pct / 100) - atr * atr_mult
strategy.exit("Long Exit", "Long", stop=sl, trail_points=atr * trail_mult * syminfo.pointvalue, trail_offset=entry_price * (trail_offset_pct / 100))
bars_held := 1
else if cetp_score < short_threshold
if strategy.position_size > 0
strategy.close("Long", comment="Reverse to Short")
if strategy.position_size >= 0
strategy.entry("Short", strategy.short)
entry_price := close
sl = entry_price * (1 + stop_loss_pct / 100) + atr * atr_mult
strategy.exit("Short Exit", "Short", stop=sl, trail_points=atr * trail_mult * syminfo.pointvalue, trail_offset=entry_price * (trail_offset_pct / 100))
bars_held := 1