help my ea does not close opened orders

 

Hi,

i want my ea to close a buy order when my macd1 is less than macd2, and it should close a sell order if macd1 is greater than macd 2, but it does not,it closes the opened orders only at take profit and stop loss alone.

please help me .

the code as been attached. thanks.

Files:
 

Check closely your magic number handling

extern int Magicnumber1=2;

OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-Stoploss*Point,Ask+Takeprofit*Point,"manifestation",1,0,Green);

OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid+Stoploss*Point,Bid-Takeprofit*Point,"manifestation",1,0,Green);

if(OrderMagicNumber()==Magicnumber1) ... close