Mats Bengtsson

Optimizing MACD might give bigger losses

Mats Bengtsson mib over the years

The standard MACD system was making a loss of 1 880 000 SEK

As was described earlier, the standard MACD does return a loss if run on all Swedish stocks going back to 1989 and further. Running the MACD system with it's standard parameters on Generalindex in Sweden (SXGE) also returns a loss. Optimization of the MACD system is easy, and when optimization is done taking commission into account (100 SEK buying and 100 SEK selling), the parameters are changed into values that do make profit on SXGE. Not a big profit, but a profit.

For this example I used the MACD system supplied with Tradestation, which has a different exit signal compared to the buy signal (in this case it exits on ADX). The original parameters for MACD was set to 12,26 and 9 days respectively, which are all fairly common choices. After optimization they were changed to 15,17 and 12 days, and the ADX length was set to 7 days. 

Doing the MACD optimization might fool you to believe you are profitable

The described settings are the best way to set the MACD system to buy on SXGE. If it was unprofitable as a whole on all stocks before, then it should at least be more profitable now. right?

Wrong!! It is even worse after omptimization than before. It is not optimized in such a way that it improves usability for all stocks. It is over fitted, using the combination of 4 variables to maximize the result on one single item (SXGE) which during the 10 years I run the MACD system only generates 80 trades. I use the term over fitted. With more parameters it would have been more appropriate to start using the term "curve fitted"

The terrible results of the runs of MACD after optimization is a loss of 2 420 000 SEK

  • Net loss has gone from 1 880 000 SEK to 2 420 000 SEK.
  • Loss per trade has gone from 110 SEK to 120 SEK
  • Minimum capital needed to cover the maximum losses in a row has gone from 32 000 SEK to 58 000 SEK
  • Percentage of winning trades has gone down

You need to know if your losses are taken by a profitable or unprofitable system

You will never know, that is for sure. But you need to believe in it so much that you can keep on trading the system, and it need to be probable that it is a good idea to keep trading your system. That means you must test you trading ideas you must test them in such a way that they are not likely to be over fitted or curve fitted.


Never trade stocks without having tested your system. In fact, most trading systems are not profitable if tested over many stocks. Full story...

Do not invest in heating equipment without having compared the alternatives, not only to current situation, but also to each other. Full story...

About me Mats Bengtsson | Mats Bengtsson Site Map | Privacy Policy | Contact me | | | ©2003 Mats Bengtsson