EA no gestiona operaciones
He codificado un EA simple para gestionar mi stoploss y takeprofit. Soy un comerciante manual. Hice esto porque es una molestia para mí tener que establecer cada vez el takeprofit y el stoploss. Adjunto mi código. Gracias por adelantado.
Código insertado extern int StopLoss = 10; extern int TakeProfit = 50; punto doble; int init() { if (Dígitos==2)punto=0.01; si (Dígitos==3)punto=0.01; si (Dígitos==4)punto=0.0001; si (Dígitos==5)punto=0.0001; retorno(0); } int deinit() { return(0); } int OrderCount(int tipo) { int buycnt,sellcnt; for (int i=OrdersTotal()-1;igt;=0;i--) { if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==true) { if (OrderSymbol()==Symbol()) { if ( OrderType()==OP_BUY)buycnt=buycnt 1; if (OrderType()==OP_SELL)sellcnt=sellcnt 1; } } } if (tipo==0)return(buycnt); de lo contrario si (tipo == 1) devuelve (sellcnt); else if (tipo==3)return(buycnt sellcnt); si no regresa(0); }/--------------------------------------------------------------- -------------------------------------------------- -------------------------/----------------------- -------------------------------------------------- ------------------------------------------------- vacío verificarStoploss() { double buystoploss, sellstoploss, buyTakeprofit, sellTakeprofit; buystoploss=Oferta-StopLoss*punto; buyTakeprofit=Preguntar TakeProfit*punto; sellstoploss=Preguntar StopLoss*punto; sellTakeprofit=Bid-TakeProfit*punto; if (OrderCount(0)gt;0 (OrderStopLoss() lt; Point || OrderTakeProfit() lt; Point) )/si no están configurados { OrderModify(OrderTicket(), OrderOpenPrice(), buystoploss, buyTakeprofit, OrderExpiration( ), CLR_NINGUNO); Dormir (3000); } if (OrderCount(1)gt;0 (OrderStopLoss() lt; Point || OrderTakeProfit() lt; Point) ) { OrderModify(OrderTicket(), OrderOpenPrice(), sellstoploss, sellTakeprofit, OrderExpiration(), CLR_NONE); Dormir (3000); } } int start() { verificarStoploss(); retorno(0); }