Coding Help Please!!!!

 

bool CheckMACrossExit(int cmd,int TimeFrame,int shift)
{
double MAFast = iMA(NULL, TimeFrame, FastMAExit, 0, MODE_LWMA, PRICE_CLOSE, shift);
double MASlow = iMA(NULL, TimeFrame, SlowMAExit, 0, MODE_EMA, PRICE_CLOSE, shift);

switch (cmd)
{
case OP_BUY : if(MAFast>MASlow) {return (true);}
break;
case OP_SELL : if(MAFast<MASlow) {return (true);}
}

return(false);

When I use EMA EXIT when ever the slow and fast EMA cross it exits the Trade...........For example when the EA went short and have EMA EXIT is TRUE
and when the EMAFast cross down EMA SLOW it Exits the trade ......

This system take a short or long before the 5,15 EMAs cross...after few bars when EMAs cross EA will exit the trade,,,,it does not care if its a short or long

its does not care if fastEMA is crossing up or down SlowEMA it will exit as long as a cross happens.

How can Change the above codding so it exits according to the rules below..1 and 2

1- Only IF Long and fastEMA Crosses below slowEMA Exit Long trade only


2- Only IF Short and fastEMA Crosses Up slowEMA Exit short trade only

It seems like it does not care if its short or long,, it does not care if its crosses down or up it closes the trade anyways when there is a cross.

ANY HELP IS APPRICIATED!!

Reason: