Why MACD crossover sample code sometimes skips signals?
Author: genelong
Creation Date: 5/30/2014 2:36 PM
profile picture

genelong

#1
Hi - new to coding WLP, please bear with me. I've copied the MACD code from the wiki, and am executing it on THRM 10min intervals over 3 wks. It seems to miss some major buy signals. For example, at 5-16 15:10 there is a crossover right before a large upswing. MACD=0.0649, and EMA of MACD=0.0555, yet there is no buy signal. Last buy signal was at 5-15 13:20.

Another one is missed at 5-21 12:50, MACD=0.1105, EMA of MACD=0.1032. These both happen to be critical buys, so total performance winds up being pretty poor.

Any explanation or help would be greatly appreciated. Thanks.
profile picture

Eugene

#2
CODE:
Please log in to see this code.


Carefully reading the comments in this example code, one can notice that a signal to buy is only accepted by the system when MACD crosses its signal line and MACD is below 0. All other cases are ignored. MACD=0.0649 and MACD=0.1105 are above 0, invalidating the setup.

Consequently, modify these lines if you want to disable that condition:

CODE:
Please log in to see this code.
profile picture

genelong

#3
Thanks, I didn't see that.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).