Trading Idea #005 – MACD 1

This idea comes to us by way of Jeff Swanson, of EasyLanguageMastery.com.  In one of his recent newsletters, he wrote about a trading system based on MACD (Moving Average Convergence/Divergence), which he saw presented in a forex trading video on YouTube (https://youtu.be/nmffSjdZbWQ).  I am taking the rules he shared, comparing to the video, and building a system based on my understanding of the rules.  I know he has done the same, but I am not going to look at his results so that I do not introduce bias in my process.  Jeff’s rules vary from the video, but I will try to follow the video’s rules as closely as possible. 

I expect this idea to fail for two reasons. 

Firstly, this uses MACD, which has a reputation for having so much lag that most of its trading signals are too late.  I have built several systems around MACD and they have epically crashed and burned.  Secondly, I assume anyone who built a system by looking at charts has introduced some form of bias (confirmation, selection, etc.).  Bias in trading has been written about a lot, but you can check the back issues of TASC magazine (Technical Analysis of Stocks & Commodities) or Kaufman Constructs Trading Systems (chapter 1) if you want to learn more. 

If you have been following along here, you will know that I expect most ideas to fail once we systematize and test them.  As I write this, we have a 25% success rate (1 of 4 systems passed), but I that success rate will fall as we continue to build systems every two weeks.  Let’s see what we get with this idea.

Phase 1: Plan & Design

1. Trading Idea

The idea is:

  • Buy when the closing price is greater than the 200 period EMA (Exponential Moving Average) and the MACD is under the zero line
  • Sell short when the closing price is less than the 200 period EMA and the MACD crosses over the zero line
  • Place a stop order at the most recent low if long; place a stop order at the most recent high if short
  • Set the profit target to two times the difference of the close and the stop price
  • Exit 1/4th of our position when risk level (e.g., 100 pips of risk) = open profit level (e.g., 100 pips beyond entry price)
  • Set breakeven for remaining position to the entry price
  • Exit remaining position when profit = 2 x risk, e.g., 200 pips

Based on the rules, the risk/reward ratio is, as I see it, 1:2.  This does not account for slippage or commission, so the actual risk is greater.  I watched the video several times and the rules are not as clear as Jeff laid out.  For futures and the ETFs, I will use 1 ATR for stop loss and 2 ATR for profit target.  Forex is simply 1%, or $100.

2. System Definition

Position Sizing:

I will use position sizing in multiples of 4 since the original rules from the video specify scaling out.

  • Futures:  4 contracts, using Micro E-minis only and Dollar Index
  • ETF:  40 shares
  • Forex:  10,000 lot size
    • Example: $10,000 USD requires $200 in margin, with 50:1 leverage (advanced math lol)

Entry:

  • Long:
    • If Close > EMA(200) and
    • MACD < 0 (zero) and
    • MACD crosses over MACD Average then
    • Buy at market
  • Short:
    • Close < EMA(200) and
    • MACD > 0 (zero) and
    • MACD crosses under MACD Average then
    • Sell short at market
  • Profit targets:
    • If profit = 100% of risk, exit 25% of position
      • Forex: exit 2,500 units
      • Futures: exit 1 contract
    • Long: (Prior Close – Prior Low) x 2 = Profit Target
    • Short (Prior High – Close) x 2 = Profit Target
  • Stop Loss:
    • 1 x ATR

Parameters (Default):

I will use the standard MACD trading system settings:

  • MACDFastLength(12)
  • MACDSlowLength(26)
  • MACDLength(9)  >> MACD Average number of bars to use
  • ATRLength(20)  >> I want ATR relatively smooth
  • EMALength(200)
  • NumberContracts(1) >> this will vary by instrument

I will not optimize any parameters.  I want to see what happens first.

Challenges:

  • Figuring out how to scale out of positions while following the system rules.

3. Performance Objectives

The MACD trading system will meet the following objectives:

ObjectiveGoal
Strategy Type (trend, mean-reversion,
day, swing, etc.)
Scalp, Breakout
Risk of ruin0%
Profit Factor>= 1.5
Win Percent>= 50%
Max Drawdown %< 35%
Profit/Drawdown Ratio>= 2.0
Ready Date2021/03/05

This idea is S.M.A.R.T.: Specific, Measurable, Achievable, Realistic, Time-bound

4. Market Selection

Markets:

EnergiesCurrenciesFixed IncomeAgricultureMetalsSoftsIndexesEquities
XXX

Instruments:

Market GroupInstrumentSymbolComments
CurrenciesForex:




Futures: Dollar Index
EUR/USD, USD/NZD, CAD/GBP, AUD/NZD, JPY/USD
DX
IndexesMicro E-minis: S&P, Dow, Russell 2000, NasdaqMES, MYM, M2K, MNQInstrument selection is based on what a trader with a smaller account would be able to trade, given that we are taking 4 contracts at a time.
EquitiesIndex ETFsDIA, QQQ, SPY, IWMI picked these to match the index futures above

Chart Type, Timeframe, Session, Time Zone:

AttributeValueComments
Chart TypeRegular CandlestickCharting is only useful for validating entry and exit signals
Timeframe / Interval(s)15, 30, 60 minute, DailyMinute timeframes for forex
Daily for all instruments
SessionRegular
Time ZoneExchange

Phase 2: Build

5. Manual Test

I was not sure what I would see during the manual test, as I looked at no charts or indicators that may have biased me.  Once I started testing, I noticed that I have tested a similar system a long time ago and it failed.

My first issue was determining how much risk and reward to assign for futures, so I decided to go with 1 ATR stop loss (1 times the ATR at entry) and 2 ATR (2 times the ATR at entry).  This may be a bad choice and I may want to gently optimize these in a future test, as each instrument may need to be tuned for profit and stop levels.  For now, I want to see what happens. 

My manual test on EUR/USD forex pair (30 minute), M2K (Russell 2000 Micro E-mini, 30 minute), RB (RBOB Gasoline, 60 minute), and DX (Dollar Index, daily) was successful with a small sample.  It is enough for me to move forward, though I remain skeptical.

6. Build

Process Diagram

Comments:

Not much to say, though this was a lot more difficult than anticipated.  I hope it is worth the effort.

7. Unit Test

Complete?

Note: Unit test verifies that the system is executing the trading rules correctly.  It is, essentially, quality control.

Phase 3: Test

8. Optimization

No optimization for this system. Woohoo!

9. Walk-Forward Analysis

Disclaimer (yes, another one): Forex is not my area of expertise, or to be more precise, I am a total noob (or newb).  It is entirely possible that I hosed the trading costs, but I was very generous in adding plenty of slippage and commission/spread cost.  I worked with the costs that I am familiar with as an OANDA client.  If you are an experienced forex trader, I apologize in advance for my bumbling.

I performed WFA on all instruments using 5 years of data; for the daily timeframe, this equates to about 4.2 years of trading, due to the use of a 200 period EMA.  I reserved 6 months of data for the Incubation step if we make it that far.  Below are the results:

ETF:

The system worked for DIA (Dow ETF) and SPY (S&P 500 ETF).  Since these are index based ETFs, I only used long positions since I do not maintain an equities margin account.  These will advance to Monte Carlo.

Forex:

This MACD trading system was disappointing overall, but particularly on forex, as this system was presented as a forex system.  I was disappointed, but not surprised.

Dollar Index:

This had potential, but the 52.3% drawdown was way over our goal (our goal is < 35%)

Index Futures:

Nothing passed here.  MNQ is of special note, specifically on the long side.  Due to an inherent long side bias of an index and how they are built, i.e., they are built to go up, it is no surprise that the short side does not work.  The successes of the two ETFs give me confidence that MNQ will work on the long side only.  Looking back 10 years, MNQ performed relatively well, but the other three micros did not.  One final observation: the micro e-mini data is synthetic, in that our data provided used the E-mini data to construct a data set that expands back in time.  Micro and E-mini data is close, but not exact. 

DIA, SPY, and MNQ will advance this to Monte Carlo and then incubation. 

10. Monte Carlo Simulation

Before starting Monte Carlo, I expanded my evaluation period to 15 years for the ETFs and 10 years for MNQ so as to provide a larger sample, given the small number of trades.

DIA and SPY failed, with a Return/Drawdown ratio of less than 1 and terrible annual returns, about $100 annually.  They both averaged about 4 trades per year, but tying up a large amount of equity (> $15,000) for paltry returns is a horrible idea.

MNQ failed, with a Return/Drawdown ratio of less than 1.0, when assuming 0% risk of ruin.  I think that this instrument would work with this system, but an annual return of 12% with zero risk of ruin is not all that great.  Our capital can be better utilized elsewhere.

Result: no passing instrument for this system.

11. Incubation

Nothing passed, so no incubation period.

Just for fun, I put MNQ into incubation using the 6 months of data I reserved.  The system took one trade in the past 6 months, 4 contracts and net profit of $5,577.00 after slippage and commission: First exit: $793.50, second exit: $4,783.50. 

Phase 4: Deploy

We did not make it this far.

Notes and Commentary

My first impression is that I bit off more than I could chew this time.  After reading Jeff’s rules, I thought it would be easy, but digging into the video made me realize there was an extra layer of complexity with the rules.  This system was a grizzly bear to code and unit test, but I eventually figured it out.

MACD trading system, as is my experience, never fails to disappoint.  Looking back into my archives I have no fewer than 7 documented failures in MACD, with many more that precede my system trading days.  This system ends up in the trash heap.  I suspect Jeff had similar results.

Why did it fail?  The likely culprits are a small sample size (100 trades on a 30 minute chart) and limited testing window.  It falls apart under rigorous testing.

A Happy Little Accident

While Unit Testing, I came across a bug that might turn out to be a ‘happy little accident’, as the late great Bob Ross would say while painting.  The exits were wrong, by rule, but somehow more profitable.  I reserved that code for further analysis in another system.

Next steps:

I do not want to resurrect this system in the future, at least on anything for the daily timeframe.  However, I am going to spend a little time running this system in simulation on USD/EUR and AUD/NZD currency pairs, mainly to see how it compares to my trading cost estimations.  Forex trading is my weakest skill-set, so this is mostly an academic exercise.  The code for scaling out of positions will be useful in the future, so I will reu. 

Feel free to leave comments below!

Trading System Result: FAIL

——————

Sources/References

Did you like what you read? Do you want to see more?  Subscribe now and receive our email twice per month, with the Trading System Idea of the Week and other fun stuff.

Don’t worry, we will never, ever, ever sell, overuse, or donate your email address. Promise.

Did you like what you read? Do you want to see more?  Subscribe now and receive our email twice per month, with the Trading System Idea of the Week and other fun stuff.

Don’t worry, we will never, ever, ever sell, overuse, or donate your email address. Promise.

2 thoughts on “Trading Idea #005 – MACD 1

Leave a Reply

Your email address will not be published. Required fields are marked *