Need help

 

how to write the code for Buylimit and selllimit @ a MA cross .

I am trying to use it for counter trend .... if anyone can modify the codes below for buylimit and selllimit orders.

//--------------------------------------------------------------------------------------//

void CheckOpen(){

bool Buy, Sell;

double MA1 =iMA(NULL,0,10,0,MODE_EMA,PRICE_CLOSE,1);

double MA2 =iMA(NULL,0,80,0,MODE_EMA,PRICE_CLOSE,1);

double MA3 =iMA(NULL,0,10,0,MODE_EMA,PRICE_CLOSE,2);

double MA4 =iMA(NULL,0,80,0,MODE_EMA,PRICE_CLOSE,2);

Sell = False;

if ( MA3 MA2 )

Sell = True;

Buy = False;

if ( MA3 > MA4 && MA1 < MA2 )

Buy = True;

double TP,SL;

//--------------------------------------------------------------------------------------//

if (Buy){

if(StopLoss==0){SL=0;}else{SL=Ask-StopLoss*Point;}

if(TakeProfit==0){TP=0;}else{TP=Ask+TakeProfit*Point;}

OrderSend(Symbol(),OP_BUY,lots,Ask,1,SL,TP,"PX4",IDT,0,LawnGreen);

}

if (Sell){

if(StopLoss==0){SL=0;}else{SL=Bid+StopLoss*Point;}

if(TakeProfit==0){TP=0;}else{TP=Bid-TakeProfit*Point;}

OrderSend(Symbol(),OP_SELL,lots,Bid,1,SL,TP,"PX4",IDT,0,HotPink);

}

}

//--------------------------------------------------------------------------------------//

thanks very much in advance ,

May God Bless you

 

Maybe Ahmad Suleman might be able to help me!!!

hope he sees this request