Type/to search

Multi Timeframe MACD Trading Strategy

Common strategy
Created: 2024-01-30 17:44:36
Last modified: 3 years ago
1
Follow
1802
Followers

img

Overview

This strategy is based on the classic MACD indicator, combined with trend judgment indicators, stop loss methods and take profit methods to form a relatively complete trend tracking trading strategy. It can be used for both cryptocurrency, forex and stock trading.

Trading Logic

  1. MACD Indicator

    • The difference between FASTLENGTH period EMA and SLOWLENGTH period EMA forms the MACD histogram
    • MACDLENGTH period EMA smooths the MACD histogram to form the MACD line
    • MACD histogram crossing 0 axis forms trading signals
  2. Trend Filter

    • ADX: Average Directional Index, to judge if a trend exists
    • MA: Moving Average, price above and below MA forms a trend
    • SAR: Parabolic SAR, SAR moving above and below price indicates trend
  3. Stop Loss

    • ATR Trailing Stop: Set stop loss based on ATR percentage
    • SAR Stop Loss: Use SAR as trailing stop loss
  4. Take Profit

    • ATR Fixed Take Profit Distance: Set fixed take profit distance based on ATR
    • Percentage Take Profit: Set percentage take profit distance
  5. Timed Exit

    • Can set exit after specified number of bars

Advantage Analysis

  1. Multiple Auxiliary Judgement

    • Trend, support and resistance judgment avoids false signals
    • ATR/SAR stop loss better controls risk
  2. Flexible Configuration

    • Choose whether to use trend filter
    • Choose ATR or SAR stop loss
    • Choose ATR or standard take profit
    • Parameters are configurable
  3. Divergence Analysis Provided

    • Displays historical regular/hidden divergences
    • Provide text notifications
  4. Easy to Optimize

    • Many built-in configurable parameters
    • Easy to test different parameter combinations

Risk Analysis

  1. Improper Parameters May Increase Losses

    • Improper ATR, SAR parameters may premature stop loss
    • Excessive take profit ratio may premature take profit
  2. Trend Failure Risk

    • Improper trend indicator parameters may cause misjudgement
    • Black swan events may cause trend failure
  3. Timed Exit Risks

    • Fixed timed exit risks losses

Optimization Directions

  1. Adjust ATR, SAR parameters for smoother stops
  2. Test different MA periods to optimize trend judgement
  3. Test adjusted take profit ratios to increase profit rate
  4. Incorporate volatility indicators to optimize configurations

Conclusion

This strategy comprehensively considers trend, stop loss, take profit, pullback identification to form a relatively complete cryptocurrency trading strategy. It combines the advantages of MACD indicators, adds trend filtering to avoid false trading; adds ATR/SAR stop loss for better risk control; pullback identification provides extra reference. The multiple configurable parameters can be easily tested and optimized. Overall, this strategy can serve as a great example for cryptocurrency strategy research.

Source
Pine
/*backtest
start: 2023-12-01 00:00:00
end: 2023-12-31 23:59:59
period: 1h
basePeriod: 15m
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/
// © systemalphatrader

//@version=4
Strategy parameters
Strategy parameters
Trend Filter
Trailing Stop Loss
Take Profit Type
Select Alerts to Display
Show Bar Color
Fast Length
Slow Length
MACD Length
Divergence Method
Divergence Type
Show Divergence Label
Plotting Lookback Bars Length
TF MA Type
TF MA Period
ATR Trailing Stop Multiplier
ATR Take Profit Multiplier
Take Profit %
BACKTEST: From Year
BACKTEST: From Month
BACKTEST: From Day
BACKTEST: To Year
BACKTEST: To Month
BACKTEST: To Day
Trade Direction
Use Timed Exit
Timed Exit Method
Bar Since Entry
Comment
All comments (0)
No data
No data
  • 1
Forums
PINE Language
Get the app
iPhone Download
© 2015 - ∞ INVENTOR PTE LTD (SG)