Código://+------------------------------------------------------------------+ //| Buy.mq4 | //+------------------------------------------------------------------+ #property copyright "" #property link "" extern double Lotes = 0.1; extern int TP = 50; extern int SL = 200; int ticket = 0; int exi_buy = 0; int start() { double preu_SL; double preu_TP; // COMPRA if (exi_buy == 0) { preu_SL = (Bid - SL * Point); if (SL <= 0) preu_SL = 0; preu_TP = Ask + TP * Point; ticket=OrderSend(Symbol(),OP_BUY,Lotes,Ask,0,0,0,"COMPRA",0,0,CLR_NONE); exi_buy = 1; //MODIFICAMOS SL Y TP if(ticket>0) { OrderSelect(ticket,SELECT_BY_TICKET); OrderModify(OrderTicket(),OrderOpenPrice(),preu_SL,preu_TP,0,CLR_NONE); } } return(0); }
Marcadores