The MACD long reversal strategy is a strategy that utilizes the MACD indicator to identify long-term price reversals and makes long-term trades. This strategy constructs the MACD indicator using the fast SMA line and slow SMA line difference of MACD, and uses the reversal pattern of the MACD histogram to identify potential long-term reversal opportunities in prices. When a price reversal opportunity is identified, the strategy will make a directional long-term entry.
The strategy uses 6-day EMA as the fast line of MACD and 26-day EMA as the slow line of MACD. The difference between the fast and slow lines is the MACD, and the 9-day SMA of MACD constitutes the signal line. When the difference between the fast and slow lines, i.e. the histogram, equals zero, it represents a balance; when positive, it represents a long-term bullish view; when negative, it represents a long-term bearish view.
The trading logic of this strategy is: When the MACD histogram rises above the previous one (the difference widens), it is considered that the price has reversed to long-term bullish (buying opportunity); When the MACD histogram falls below the previous one (the difference narrows), the price is considered to have reversed to long-term bearish (selling opportunity). To filter out false signals, this strategy will wait for the actual reversal of two histograms before entering.
The MACD long reversal strategy captures long-term reversal opportunities in prices by judging the reversal of the MACD histogram. This strategy successfully controls the conflict between short-term and long-term cycles, as well as avoiding chasing highs and selling lows. However, as a single indicator strategy, the MACD long reversal strategy also has certain limitations, and there is still room for further optimization, especially when used in combination with other indicators.
/*backtest start: 2022-12-08 00:00:00 end: 2023-12-14 00:00:00 period: 1d basePeriod: 1h exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © TheGrindToday //@version=4 strategy("MACD Long Strat", overlay=false) //fast = 12, slow = 26 fast = 6, slow = 26 fastMA = ema(close, fast) slowMA = ema(close, slow) macd = fastMA - slowMA signal = sma(macd, 9) histogram = macd-signal macdpos = histogram[0] > 0 macdneg = histogram[0] < 0 histogram_reversing_negative = histogram[1] > histogram[2] LongEntryCondition = histogram > histogram[1] ShortEntryCondition = histogram < histogram[1] exitConditionLong = histogram[0] < histogram[2] if (LongEntryCondition and histogram_reversing_negative) strategy.entry("Long", strategy.long) if (exitConditionLong) strategy.close("Long") plot(histogram)