Dual MACD Quantitative Trading Strategy (2024)

  1. Square
  2. Dual MACD Quantitative Trading Strategy

Author: ChaoZhang, Date: 2023-11-13 18:04:07
Tags:

Dual MACD Quantitative Trading Strategy (1)

Overview

This strategy utilizes the combination of dual EMA systems and RSI indicators to determine market trends while generating trading signals. It belongs to the trend following strategies. This simple and easy-to-use strategy is applicable to various major indices and cryptocurrencies. It has achieved over 500% cumulative returns in backtests from 2013 to present.

Strategy Logic

This strategy employs two MACDs with different parameter settings as the primary trading indicators. The first MACD adopts 10-period short EMA, 22-period long EMA, and 9-period signal line. The second MACD uses 21-period short EMA, 45-period long EMA, and 20-period signal line.

The first MACD generates buy signals when the DIFF line crosses above zero, and sell signals when crossing below zero. The signals from the second MACD act to confirm those from the first MACD.

In addition, the strategy utilizes a price momentum formula to determine the trend. The latest close + high divided by previous close + high above 1 indicates an upward trend and generates buy signals, and vice versa for sell signals.

Lastly, Stoch RSI K line above 20 helps confirm sell signals.

Advantage Analysis

The dual EMA mechanism in this strategy can effectively filter false breakouts. The supplementary momentum formula also avoids wrong signals caused by volatility. The incorporation of Stoch RSI avoids chasing tops by issuing sell signals around overbought areas.

This strategy only uses simple combinations of several common indicators without overly complex logic relationships, which makes it very easy to understand and modify. The parameter settings are also quite universal without the need for optimization for different products, giving the strategy great adaptability.

According to backtest results, this strategy has achieved decent cumulative returns and maximum drawdown control across various products like stock indices and cryptocurrencies. It can serve as a versatile trend following strategy.

Risk Analysis

The main risk of this strategy lies in using moving averages for determinations, which can easily cause whipsaws and losses when prices fluctuate violently. In addition, there is no stop loss mechanism to control losses on single positions.

The effectiveness of Stoch RSI in detecting overbought/oversold levels is not ideal. It may miss reversal signals frequently.

If prices crash sharply but MACD has not formed a death cross yet, this strategy will hold onto losing positions and continue taking losses.

Optimization Directions

Consider adding stop loss to control single position losses, e.g. ATR stop loss or stop loss based on lower moving averages.

Add other indicators for confirmation, such as combining KD or Bollinger Bands with Stoch RSI for more reliable overbought/oversold detection.

Incorporate volume analysis, like raising stop loss when significant selling volume appears, or avoiding new positions when volume is weak.

Test different parameter combinations and optimize MACD periods. Also test adding MACDs of other timeframes for multiple confirmation.

Conclusion

The dual MACD quantitative trading strategy has simple and clear logic, using dual EMA crossovers to determine trends, supplemented by momentum indicators to avoid wrong signals. It can filter out high-probability trading opportunities. The universal parameter settings and solid performance make it a good foundation strategy to build upon. The next steps are to further enhance its stability and profitability by improving stop loss mechanisms, adding volume analysis, combining other indicators, etc.

/*backteststart: 2023-10-13 00:00:00end: 2023-11-12 00:00:00period: 1hbasePeriod: 15mexchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]*///@version=2strategy("Multiple MACD RSI simple strategy", overlay=true, initial_capital=5000, default_qty_type=strategy.percent_of_equity, default_qty_value=80, pyramiding=0, calc_on_order_fills=true)fastLength = input(10)slowlength = input(22)MACDLength = input(9)MACD = ema(close, fastLength) - ema(close, slowlength)aMACD = sma(MACD, MACDLength)delta = MACD - aMACDfastLength2 = input(21)slowlength2 = input(45)MACDLength2 = input(20)MACD2 = ema(open, fastLength2) - ema(open, slowlength2)aMACD2 = sma(MACD2, MACDLength2)delta2 = MACD2 - aMACD2uptrend = (close + high)/(close[1] + high[1])downtrend = (close + low)/(close[1] + low[1])smoothK = input(2, minval=1, title="K smoothing Stoch RSI")smoothD = input(3, minval=1, title= "D smoothing for Stoch RSI")lengthRSI = input(7, minval=1, title="RSI Length")lengthStoch = input(8, minval=1, title="Stochastic Length")src = input(close, title="RSI Source")rsi1 = rsi(src, lengthRSI)k = sma(stoch(rsi1, rsi1, rsi1, lengthStoch), smoothK)d = sma(k, smoothD)h0 = hline(80)h1 = hline(20)yearin = input(2018, title="Year to start backtesting from")if (delta > 0) and (year>=yearin) and (delta2 > 0) and (uptrend > 1) strategy.entry("buy", strategy.long, comment="buy")if (delta < 0) and (year>=yearin) and (delta2 < 0) and (downtrend < 1) and (d > 20) strategy.entry("sell", strategy.short, comment="sell")//plot(strategy.equity, title="equity", color=red, linewidth=2, style=areabr)

template: strategy.tpl:40:21: executing "strategy.tpl" at <.api.GetStrategyListByName>: wrong number of args for GetStrategyListByName: want 7 got 6

Dual MACD Quantitative Trading Strategy (2024)
Top Articles
How to Clean & Disinfect Wood Furniture without Damaging Finish | Pine-Sol®
Child Tax Credit 2024: Where Is Your Refund Money?
Great Clips Mount Airy Nc
Craigslist Home Health Care Jobs
Trevor Goodwin Obituary St Cloud
His Lost Lycan Luna Chapter 5
Mr Tire Rockland Maine
Ou Class Nav
Culos Grandes Ricos
Wgu Admissions Login
Healing Guide Dragonflight 10.2.7 Wow Warring Dueling Guide
Raleigh Craigs List
Guidewheel lands $9M Series A-1 for SaaS that boosts manufacturing and trims carbon emissions | TechCrunch
The Banshees Of Inisherin Showtimes Near Regal Thornton Place
Playgirl Magazine Cover Template Free
Velocity. The Revolutionary Way to Measure in Scrum
Lcwc 911 Live Incident List Live Status
Uta Kinesiology Advising
Veracross Login Bishop Lynch
Great Clips Grandview Station Marion Reviews
Dtlr Duke St
European city that's best to visit from the UK by train has amazing beer
Craigslist Lake Charles
Discord Nuker Bot Invite
Relaxed Sneak Animations
Summoners War Update Notes
Stickley Furniture
Miller Plonka Obituaries
Winterset Rants And Raves
What Is Opm1 Treas 310 Deposit
The Monitor Recent Obituaries: All Of The Monitor's Recent Obituaries
What Is The Lineup For Nascar Race Today
Culver's Hartland Flavor Of The Day
The Pretty Kitty Tanglewood
Glossytightsglamour
Watchseries To New Domain
Raisya Crow on LinkedIn: Breckie Hill Shower Video viral Cucumber Leaks VIDEO Click to watch full…
The best Verizon phones for 2024
Enjoy4Fun Uno
M Life Insider
2023 Fantasy Football Draft Guide: Rankings, cheat sheets and analysis
Andrew Lee Torres
Powerboat P1 Unveils 2024 P1 Offshore And Class 1 Race Calendar
Academic Notice and Subject to Dismissal
Eat Like A King Who's On A Budget Copypasta
How the Color Pink Influences Mood and Emotions: A Psychological Perspective
Aloha Kitchen Florence Menu
Amateur Lesbian Spanking
Haunted Mansion Showtimes Near Millstone 14
Blog Pch
Craigslist Charlestown Indiana
Latest Posts
Article information

Author: Jonah Leffler

Last Updated:

Views: 6563

Rating: 4.4 / 5 (65 voted)

Reviews: 88% of readers found this page helpful

Author information

Name: Jonah Leffler

Birthday: 1997-10-27

Address: 8987 Kieth Ports, Luettgenland, CT 54657-9808

Phone: +2611128251586

Job: Mining Supervisor

Hobby: Worldbuilding, Electronics, Amateur radio, Skiing, Cycling, Jogging, Taxidermy

Introduction: My name is Jonah Leffler, I am a determined, faithful, outstanding, inexpensive, cheerful, determined, smiling person who loves writing and wants to share my knowledge and understanding with you.