This strategy is a dual-confirmation trend following trading system that combines MACD indicator with Supertrend indicator. The strategy determines entry points by comparing MACD line crossovers with signal line while considering Supertrend direction, incorporating fixed percentage stop-loss and take-profit levels for risk management. This dual-confirmation mechanism enhances the reliability of trading signals and effectively reduces interference from false signals.
The core logic of the strategy is based on the following key elements:
The strategy constructs a relatively reliable trend following trading system by combining advantages of MACD and Supertrend indicators. The 46% accuracy rate and 46% return demonstrate profitable potential. Through suggested optimizations, particularly dynamic stop-loss and market environment filtering, strategy stability and adaptability can be further enhanced. Suitable for intraday and futures trading, users should note market environment compatibility and adjust parameters according to actual conditions.
/*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)