somebody guide me how to write ea close order when it profit 2 pips

 

hi all,

i want to write 1 ea close order when it profit 2 pips, not take profit .

thanks all.

sorry for my english,

 
671988:
i want to write 1 ea close order when it profit 2 pips, not take profit .
#define Slippage.Pips 3
#define Close.Pips    2
//++++ These are adjusted for 5 digit brokers.
double  pips2points,    // slippage  3 pips    3=points    30=points
        pips2dbl;       // Stoploss 15 pips    0.0015      0.00150
int     Digits.pips;    // DoubleToStr(dbl/pips2dbl, Digits.pips)
int init(){
    if (Digits == 5 || Digits == 3){    // Adjust for five (5) digit brokers.
                pips2dbl    = Point*10; pips2points = 10;   Digits.pips = 1;
    } else {    pips2dbl    = Point;    pips2points =  1;   Digits.pips = 0; }
    // OrderSend(... Slippage.Pips * pips2points, Bid - StopLossPips * pips2dbl
}
ini start(){
    for(int pos = OrdersTotal()-1; pos >= 0 ; pos--) if (
        OrderSelect(pos, SELECT_BY_POS)                 // Only my orders w/
//  &&  OrderMagicNumber() == magic.number.last         // my magic number
    &&  OrderType()        <= OP_SELL
    &&  OrderSymbol()      == Symbol() ){               // and symbol
        if (OrderType() == OP_BUY){ double market=Bid;  int DIR=+1; }
        else{                              market=Ask;      DIR=-1; }
        if ( (market-OrderOpenPrice())*DIR >= Close.Pips*pips2dbl) 
           OrderClose( OrderTicket(), OrderLots(), market,
                                 Slippage.Pips*pips2points);
}   }
 

THANK WHRoeder so much!!


but can u create the ea close 2 pip for me ??? please !!! i put your code into the meta editor and save, but it didn't use.


thank u so much