Type/to search

MACD-based Dual Trading Strategy

Cryptocurrency
Created: 2023-12-07 17:11:52
Last modified: 3 years ago
1
Follow
1779
Followers

img

Overview

This strategy implements a dual trading strategy based on the MACD indicator. It can go long when there is a golden cross on the MACD and go short when there is a death cross, with additional filters based on other indicators to eliminate some invalid signals.

Strategy Principle

The core of this strategy is utilizing the MACD indicator to realize dual-directional trading. Specifically, it calculates the fast moving average, slow moving average and MACD signal line. When the fast MA crosses over the slow MA, a golden cross is generated for going long. When the fast MA crosses below the slow MA, a death cross is generated for going short.

To filter out some invalid signals, the strategy also sets a ±30 range as a filter, so that trade signals are only triggered when the MACD histogram exceeds this range. In addition, when closing positions, it also judges the direction of the MACD histogram - positions are closed only when the directions of two successive histogram bars change.

Advantages

  • MACD indicator is used as the main trading signal, which is sensitive to price movements in both directions
  • Added filters help eliminate some invalid signals
  • The two-bar directional logic for closing positions avoids some false breakouts to some extent

Risks

  • MACD indicator tends to generate frequent trade signals, leading to high trading frequency
  • Relying solely on one indicator makes the strategy vulnerable to signal delays
  • The closing logic based on histogram direction is not rigorous enough, risks missing some signals

Optimization Directions

  • Consider combining with other indicators for signal confirmation, like KDJ, Bollinger Bands etc.
  • Research more advanced indicators to replace MACD, like KD
  • Optimize the closing logic by setting stop loss and take profit to control single trade loss

Conclusion

In summary, this is a basically feasible dual directional trading strategy. It utilizes the advantages of MACD indicator and also adds some filters to control signal quality. However, MACD itself has some issues as well. Further testing and optimization in live trading is still needed to make the strategy more reliable. Overall speaking, this strategy lays the foundation for dual-directional trading strategies, and can be further optimized incrementally to become a powerful quantitative trading strategy.

]

Source
Pine
/*backtest
start: 2022-11-30 00:00:00
end: 2023-12-06 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=3

//Created by user ChrisMoody updated 4-10-2014
//Regular MACD Indicator with Histogram that plots 4 Colors Based on Direction Above and Below the Zero Line
Strategy parameters
Strategy parameters
Use Current Chart Resolution?
Use Different Timeframe? Uncheck Box Above
Show MacD & Signal Line? Also Turn Off Dots Below
Show Dots When MacD Crosses Signal Line?
Show Histogram?
Change MacD Line Color-Signal Line Cross?
MacD Histogram 4 Colors?
fastLength
slowLength
signalLength
Comment
All comments (0)
No data
No data
  • 1
iPhone Download
Forums
PINE Language
© 2015 - ∞ INVENTOR PTE LTD (SG)