MACD sample EA MT4 help

 

Hi all,

I need help understanding the behaviour of MACD sample EA that is downloaded with the MetaTrader 4.

I ran the EA with the default settings on USDCAD, H1. The interesting period is 2015.07.31 to 2015.08.06. The EA opens a sell order on 2015.07.31 that ends with a huge loss on 2015.08.06. My question is: Why didn't the trailing stop kick in? If one looks at the mql4 code it is clear that the condition on line 127 is not fulfilled to close the trade. However, the conditions on lines 136-140 should be fulfilled. The trade continued to be open in spite of these conditions.

 Anyone knows what is the reason for that? And how to solve it?

Any help is welcome. Thanks in advance.

Regards