Can anyone help to add function on EA.

 

Hello,

I have one ea which place buy and sell at a time.

//-----------------------Buy and sell codes-----------------//

buy=OrderSend(Symbol(),OP_BUY,lots,NormalizeDouble(Ask,Digits),30,0,0,"Learning",MagicNumber,0,clrBlue); 

 sell=OrderSend(Symbol(),OP_SELL,lots,NormalizeDouble(Bid,Digits),30,0,0,"Learning",MagicNumber,0,clrRed);

 starttime=TimeCurrent();

 }


//----------------Now what it do--------------//

If tp=30 Pips it close anyone trade.

lets assume it close buy and on that same time it place another sell.


 if(TakeProfit!=0&&LastPrice(OP_BUY)!=0&&Bid-LastPrice(OP_BUY)>=TakeProfit*point&&orderscnt(OP_BUY)==1){

 CloseOrders(OP_BUY);

 if(orderstotal()>=0&&orderstotal()<10000)lots=Lot1;

 sell=OrderSend(Symbol(),OP_SELL,lots,NormalizeDouble(Bid,Digits),30,0,0,"Learning",MagicNumber,0,clrRed);

 }


Now what i want. market goes down for 30 pips more. It will place another sell. Until it get reversed and close all trades on close condition.


Sorry for my bad English.


Thanks in advance.

 
Winners786: Now what i want.
  1. When you post code please use the CODE button (Alt-S)! (For large amounts of code, attach it.) Please edit your (original) post.
              General rules and best pratices of the Forum. - General - MQL5 programming forum
              Messages Editor

  2. Help you with what? You haven't stated a problem, you stated a want. Show us your attempt (using CODE button) and state the nature of your problem.
              No free help
              urgent help.

Reason: