generate a sell/buy at third signal EA

 

hi all,

I have build an EA that generates a sell/buy when the fast macd crosses the slow macd signal.

But i want to build a new one. This new EA must generate a sell when macd is > than 0 and fast macd crosses the slow macd for the third time in a row, or at the third signal the macd crosses below zero. Same rules count for a buying signal. Please help me.

Reason: