
この戦略は,MACD指標とSupertrend指標を組み合わせた二重検証のトレンド追跡システムである.戦略は,MACD線とシグナル線の交差点を比較し,同時にSupertrend指標のトレンド方向を組み合わせて入場時間を決定し,リスクを管理するために固定パーセントのストップとストップのレベルを設定している.この二重検証の仕組みは,取引信号の信頼性を高め,偽の信号の干渉を効果的に軽減する.
戦略の中核となるロジックは、次の主要な要素に基づいています。
この戦略は,MACDとSupertrend指標の優位性を組み合わせて,比較的信頼性の高いトレンド追跡取引システムを構築している. 精度46%と収益率46%は,戦略が一定の収益性を示している. 戦略の安定性と適応性は,推奨された最適化方向,特にダイナミックストップと市場環境フィルターの導入によってさらに向上すると見込まれている.
/*backtest
start: 2024-11-10 00:00:00
end: 2024-12-09 08:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy('MANTHAN BHRAMASTRA', overlay=true)
// Supertrend function
f_supertrend(_period, _multiplier) =>
atr = ta.sma(ta.tr, _period)
upTrend = hl2 - _multiplier * atr
downTrend = hl2 + _multiplier * atr
var float _supertrend = na
var int _trendDirection = na
_supertrend := na(_supertrend[1]) ? hl2 : close[1] > _supertrend[1] ? math.max(upTrend, _supertrend[1]) : math.min(downTrend, _supertrend[1])
_trendDirection := close > _supertrend ? 1 : -1
[_supertrend, _trendDirection]
// Supertrend Settings
factor = input(2, title='Supertrend Factor')
atrLength = input(20, title='Supertrend ATR Length')
// Calculate Supertrend
[supertrendValue, direction] = f_supertrend(atrLength, factor)
// MACD Settings
fastLength = input(12, title='MACD Fast Length')
slowLength = input(26, title='MACD Slow Length')
signalSmoothing = input(9, title='MACD Signal Smoothing')
// Calculate MACD
[macdLine, signalLine, _] = ta.macd(close, fastLength, slowLength, signalSmoothing)
// Generate Buy signals
buySignal = ta.crossover(macdLine, signalLine) and direction == 1
// Plot Buy signals
// Calculate stop loss and take profit levels (0.25% of the current price)
longStopLoss = close * 0.9950
longTakeProfit = close * 1.9999
// Execute Buy orders with Target and Stop Loss
if buySignal
strategy.entry('Buy', strategy.long)
strategy.exit('Sell', 'Buy', stop=longStopLoss, limit=longTakeProfit)