CODING FOR macd and market trend

 
I find it hard to write this code for EA.MACD rising while market is falling as indicated by the bars or MACD falling aaaaaaand market is rising.If a code for this relationship can be written i can make some market order.Anyone to help please.
Reason: