
This strategy is a dynamic trend-following system based on technical analysis, primarily utilizing dual moving averages (200-day SMA and 21-week EMA) to identify market trends. The strategy integrates the Relative Strength Index (RSI) and Average Directional Index (ADX) as momentum filters, combined with Average True Range (ATR) for dynamic risk management, achieving precise capture of uptrends and effective risk control.
The core logic of the strategy is built on several key elements: 1. Uses dual confirmation from 200-day Simple Moving Average (SMA) and 21-week Exponential Moving Average (EMA) to define bullish market conditions 2. Ensures continued upward momentum through RSI>50 condition 3. Validates trend strength with ADX>25 condition 4. Implements dynamic stop-loss based on ATR, providing risk control adapted to market volatility 5. Employs percentage-based take-profit mechanism to secure gains at predetermined levels
This is a well-designed trend-following strategy with clear logic, effectively balancing returns and risks through multiple technical indicators. The strategy’s high customizability makes it suitable for maintaining effectiveness across different market environments through parameter optimization. While it carries some inherent lag risks, the comprehensive risk control mechanisms contribute to overall stability and reliability.
/*backtest
start: 2022-02-09 00:00:00
end: 2025-02-06 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=6
strategy("BTCUSDT Daily - Enhanced Bitcoin Bull Market Support [CYRANO]", shorttitle="BTCUSDT Daily BULL MARKET", overlay=true, commission_type=strategy.commission.percent, commission_value=0.1, slippage=3)
// Inputs
smaLength = input.int(200, title="SMA Length (Bull Market)")
emaLength = input.int(147, title="EMA Length (21-Week Approximation)")
atrLength = input.int(14, title="ATR Length")
riskATR = input.float(2.0, title="ATR Multiplier for Stop Loss", step=0.1)
takeProfitPercent = input.float(10.0, title="Take Profit (%)", step=0.1)
rsiFilter = input.bool(true, title="Enable RSI Filter")
rsiLength = input.int(14, title="RSI Length")
adxFilter = input.bool(true, title="Enable ADX Filter")
adxThreshold = input.float(25, title="ADX Threshold")
// Date Range Filter
startDate = input(timestamp("2018-01-01 00:00 +0000"), title="Start Date")
endDate = input(timestamp("2069-12-31 00:00 +0000"), title="End Date")
inDateRange = true
// Moving Averages
sma200 = ta.sma(close, smaLength)
ema21w = ta.ema(close, emaLength)
// ATR Calculation
atr = ta.atr(atrLength)
stopLoss = close - (riskATR * atr)
takeProfit = close * (1 + takeProfitPercent / 100)
// RSI Filter
rsi = ta.rsi(close, rsiLength)
rsiCondition = rsiFilter ? rsi > 50 : true
// ADX Filter
[diplus, diminus, adx] = ta.dmi(14, 14)
adxCondition = adxFilter ? adx > adxThreshold : true
// Entry and Exit Conditions
buyCondition = inDateRange and close > sma200 and close > ema21w and rsiCondition and adxCondition
exitCondition = inDateRange and (close < sma200 or close < ema21w)
// Strategy Execution
if buyCondition
strategy.entry("BUY", strategy.long, stop=stopLoss, limit=takeProfit)
if exitCondition
strategy.close("BUY")
// Plot MAs
plot(sma200, title="200-Day SMA", color=color.blue, linewidth=2)
plot(ema21w, title="21-Week EMA", color=color.purple, linewidth=2)
// Background Highlight
bullColor = color.new(color.green, 80)
bearColor = color.new(color.red, 80)
bgcolor(close > sma200 and close > ema21w ? bullColor : bearColor, title="Bull Market Background")