EA autostoploss from BE to 1+. Help needed.

 
I downloaded automatic stoploss EA from database which changes price to BE at choosen price. But i would like to change the price to +1 intstead of BE, because i practice on ECN account and there is commision, so instead of BE i would always lose some amount. This change i think is easy, but i cannot code. Can anybody help?
Here is the code:
//+------------------------------------------------------------------+
//| TPSL-Insert.mq4 |
//| |
//| |
//+------------------------------------------------------------------+
#property link ""

//---- input parameters
//extern double TakeProfitPips=35;
//extern double StopLossPips=100;
extern double Move_SL_at = 0.9175;


int Faktor, Digt, cnt;
double TPp, SLp, Total, i;

//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init(){}

//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit(){}

//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+



int start()
{

double OP = OrderOpenPrice();
double BCP = High[0];
double SCP = Low[0];

Total=OrdersTotal();
if(Total>0)
{
for(i=Total-1; i>=0; i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
{
if(OrderSymbol() == Symbol()){


if(OrderStopLoss()==0 )
{
if(OrderType()==OP_BUY && BCP>Move_SL_at)
{SLp = OP;
OrderModify(OrderTicket(),OrderOpenPrice(),SLp,TPp,0);
SendMail("","Stop Loss has just been moved to : "+DoubleToStr(SLp,5)+"" );
}
if(OrderType()==OP_SELL && SCP<Move_SL_at)
{SLp = OP;
OrderModify(OrderTicket(),OrderOpenPrice(),SLp,TPp,0);
SendMail("","Stop Loss has just been moved to : "+DoubleToStr(SLp,5)+"" );
}
} else SLp = OrderStopLoss();
}}} }


Comment(

"\nStop Loss will move to BE at ", Move_SL_at);
/*
//---------------Modify Order--------------------------
if (OrderType()==OP_BUY || OrderType()==OP_SELL)
OrderModify(OrderTicket(),OrderOpenPrice(),SLp,TPp,0);
//-----------------------------------------------------
*/
Print ("Order Type= ",OrderType());
Print ("Open= ",OrderOpenPrice());
Print ("Ticket= ",OrderTicket());
Print ("Chart= ",OrderSymbol());
Print ("BCP= ",BCP);
Print ("SCP= ",SCP);


return(0);
}// Start()
//+------------------------------------------------------------------+
 
olympus999:
But i would like to change the price to +1 intstead of BE
This change i think is easy, but i cannot code.
  1. Yes it is easy but No Slaves here, learn to code or pay someone. We're not going to code it FOR you. We are willing to HELP you.

  2. int start()
    {
       double OP = OrderOpenPrice();
    Since there is no orderSelect yet so OrderOpenPrice() is bogus. Move the line to AFTER the orderSelect

  3. {SLp = OP;
    Modify the two lines to OP+pips2dbl or OP-pips2dbl.
    //++++ These are adjusted for 5 digit brokers.
    int     pips2points;    // slippage  3 pips    3=points    30=points
    double  pips2dbl;       // Stoploss 15 pips    0.015      0.0150
    int     Digits.pips;    // DoubleToStr(dbl/pips2dbl, Digits.pips)
    int     init(){
         if (Digits % 2 == 1){      // DE30=1/JPY=3/EURUSD=5 forum.mql4.com/43064#515262
                    pips2dbl    = Point*10; pips2points = 10;   Digits.pips = 1;
        } else {    pips2dbl    = Point;    pips2points =  1;   Digits.pips = 0; }
        // OrderSend(... Slippage.Pips * pips2points, Bid - StopLossPips * pips2dbl
    //---- These are adjusted for 5 digit brokers.
        /* On ECN brokers you must open first and THEN set stops
        int ticket = OrderSend(..., 0,0,...)
        if (ticket < 0)
           Alert("OrderSend failed: ", GetLastError());
        else if (!OrderSelect(ticket, SELECT_BY_TICKET))
           Alert("OrderSelect failed: ", GetLastError());
        else if (!OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0)
           Alert("OrderModify failed: ", GetLastError());
         */
    

 
Thank you! I know in the future.
Reason: