pagará: busco un codificador para actualizar mi EA para una nueva versión de MT4
pagará: busco un codificador para actualizar mi EA para una nueva versión de MT4

 

Publi

Resultados 1 al 3 de 3

Tema: pagará: busco un codificador para actualizar mi EA para una nueva versión de MT4

  1. #1
    Hola, necesito actualizar el código adjunto para que funcione en la última versión de mt4.

    Con mucho gusto pagaré por cualquier ayuda.

    gracias

    Inserted Code #include lt;stdlib.mqhgt; extern int myMagic = 123; extern double TakeProfit =500; extern bool PartialClosing = True; extern int TPDivide = 1; extern double StopLoss =500; extern int TrailingStop =0; extern double BreakEvenStop =0; extern int slippage=2; extern int shift=0; extern double Lots = 0.10; extern double MaximumRisk = 1.0;/extern bool FixedLot = true; extern int TimeStart1=000; extern int TimeStop1=2359; extern int TimeStart2=0000; extern int TimeStop2=0000; extern int TimeStart3=0000; extern int TimeStop3=0000; extern int TimeStart4=0000; extern int TimeStop4=0000; extern int OrderTriesNumber=25; bool buysig,sellsig,closebuy,closesell; int lastsig,tries; double LotsRisk(int StopLoss) { double lot=Lots;/---- select lot size if (!FixedLot (StopLoss gt; 0)) lot=NormalizeDouble(AccountFreeMargin()*MaximumRis k*0.001/StopLoss,2); else lot=Lots;/---- return lot size if(lotlt;0.01) lot=0.01; return(lot); }/ ------------------------------------------------------------------ /| Calculate open positions |/ ------------------------------------------------------------------ int CalculateCurrentOrders(string symbol) { int buys=0,sells=0;/---- for(int i=0;ilt;OrdersTotal();i ) { if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false ) continue; if(OrderSymbol()==Symbol() OrderMagicNumber()==myMagic) { if(OrderType()==OP_BUY) buys ; if(OrderType()==OP_SELL) sells ; } }/---- return orders volume if(buysgt;0) return(buys); else return(-sells); }/ ------------------------------------------------------------------ /| Check for open order conditions |/ ------------------------------------------------------------------ void CheckForSignals(datetime tradeopenbar) { sellsig=false; buysig=false; if(tradeopenbarlt;Time#91;0#93;){ if (Close#91;0#93;gt;Close#91;50#93;) { buysig=true; } if (Close#91;0#93;lt;Close#91;50#93;) { sellsig=true; } } closebuy=false; closesell=false; if (High#91;0#93;lt;Low#91;0#93;) { closebuy=true; } if (High#91;0#93;lt;Low#91;0#93;) { closesell=true; } } datetime CheckForOpen(datetime orderopenbar) { int res,ct; datetime result = orderopenbar; ct=Hour()*100 Minute(); if ( !((ctgt;=TimeStart1 ctlt;TimeStop1) || (ctgt;=TimeStart2 ctlt;TimeStop2) || (ctgt;=TimeStart3 ctlt;TimeStop3) || (ctgt;=TimeStart4 ctlt;TimeStop4)) ) return(result); double takeProfit; double SetLots=0; string EAComment='';/---- sell conditions if(sellsig lastsig!=-1) { res=0; tries=0; while (reslt;=0 trieslt;OrderTriesNumber) { while(!IsTradeAllowed()) Sleep(5000); RefreshRates(); if(TakeProfit gt; MarketInfo(Symbol(), MODE_STOPLEVEL)) takeProfit = Bid-TakeProfit*Point; else takeProfit = 0; SetLots=LotsRisk(StopLoss); EAComment=TimeWave EURUSD M15; res=OrderSend(Symbol(),OP_SELL,SetLots,Bid,slippag e,Bid StopLoss*Point, takeProfit,EAComment,myMagic,0,DeepPink); if (reslt;0) Print(Error opening SELL order : ,ErrorDescription(GetLastError())); else result = Time#91;0#93;;/return this bar open time. tries ; } lastsig= 0; return(result); }/---- buy conditions if(buysig lastsig!=1) { res=0; tries=0; while (reslt;=0 trieslt;OrderTriesNumber) { while(!IsTradeAllowed()) Sleep(5000); RefreshRates(); if(TakeProfit gt; MarketInfo(Symbol(), MODE_STOPLEVEL)) takeProfit = Ask TakeProfit*Point; else takeProfit = 0; SetLots=LotsRisk(StopLoss); EAComment=TimeWave EURUSD M15; res=OrderSend(Symbol(),OP_BUY,LotsRisk(StopLoss),A sk,slippage,Ask-StopLoss*Point, takeProfit,EAComment,myMagic,0,Yellow); if (reslt;0) Print(Error opening BUY order : ,ErrorDescription(GetLastError())); else result = Time#91;0#93;;/return this bar open Time tries ; } lastsig = 0; return(result); } return(result); } / ------------------------------------------------------------------ /| Check for close order conditions |/ ------------------------------------------------------------------ void CheckForClose() { bool bres; int tr; for(int i=0;ilt;OrdersTotal();i ) { if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false ) break; if(OrderMagicNumber()!=myMagic || OrderSymbol()!=Symbol()) continue; /---- check order type if(OrderType()==OP_BUY) { if (closebuy) { bres=false; tries=0; while (!bres trieslt;OrderTriesNumber) { while(trlt;7 !IsTradeAllowed()) { tr ; Sleep(5000); } RefreshRates(); bres=OrderClose(OrderTicket(),OrderLots(),Bid,slip page,White); Sleep(3000); if (!bres) Print(Error closing order : ,ErrorDescription(GetLastError())); tries ; } } else if(PartialClosing) PartialClosingExe(); break; } if(OrderType()==OP_SELL) { if (closesell) { bres=false; tries=0; while (!bres trieslt;OrderTriesNumber) { while(trlt;7 !IsTradeAllowed()) { tr ; Sleep(5000); } RefreshRates(); bres=OrderClose(OrderTicket(),OrderLots(),Ask,slip page,White); Sleep(3000); if (!bres) Print(Error closing order : ,ErrorDescription(GetLastError())); tries ; } } else if(PartialClosing) PartialClosingExe(); break; } } } void BreakEvenStop() { bool bres; double StopLoss; if ( BreakEvenStop gt; 2 ) { for (int i = 0; i lt; OrdersTotal(); i ) { if ( OrderSelect (i, SELECT_BY_POS) == false ) continue; if ( OrderSymbol() != Symbol() || OrderMagicNumber() != myMagic ) continue; if ( OrderType() == OP_BUY ) { if ( (Bid lt; OrderOpenPrice() BreakEvenStop*Point) ) return; StopLoss = OrderOpenPrice(); if ( StopLoss gt; OrderStopLoss() ) { bres=OrderModify (OrderTicket(), OrderOpenPrice(), StopLoss 4*Point, OrderTakeProfit(), 0, White); Sleep(3000); if (!bres) Print(Error Modifying BUY order : ,ErrorDescription(GetLastError())); } } if ( OrderType() == OP_SELL ) { if ( (Ask gt; OrderOpenPrice()-BreakEvenStop*Point) ) return; StopLoss = OrderOpenPrice(); if ( StopLoss lt; OrderStopLoss() ) { bres=OrderModify (OrderTicket(), OrderOpenPrice(), StopLoss-4*Point, OrderTakeProfit(), 0, White); Sleep(3000); if (!bres) Print(Error Modifying SELL order : ,ErrorDescription(GetLastError())); } } } } return; } void TrailingStop() { bool bres; double StopLoss; if ( TrailingStop gt; MarketInfo(Symbol(), MODE_STOPLEVEL)) { for (int i = 0; i lt; OrdersTotal(); i ) { if ( OrderSelect (i, SELECT_BY_POS) == false ) continue; if ( OrderSymbol() != Symbol() || OrderMagicNumber() != myMagic ) continue; if ( OrderType() == OP_BUY ) { if ( (Bid lt; OrderStopLoss() TrailingStop*Point) ) return; StopLoss = Bid-TrailingStop*Point; if ( StopLoss gt; OrderStopLoss() ) { bres=OrderModify (OrderTicket(), OrderOpenPrice(), StopLoss, OrderTakeProfit(), 0, White); Sleep(3000); if (!bres) Print(Error Modifying BUY order : ,ErrorDescription(GetLastError())); } } if ( OrderType() == OP_SELL ) { if ( (Ask gt; OrderStopLoss()-TrailingStop*Point) ) return; StopLoss = Ask TrailingStop*Point; if ( StopLoss lt; OrderStopLoss() ) { bres=OrderModify (OrderTicket(), OrderOpenPrice(), StopLoss, OrderTakeProfit(), 0, White); Sleep(3000); if (!bres) Print(Error Modifying SELL order : ,ErrorDescription(GetLastError())); } } } } return; } double RoundLots(string S, double P) { double value=P; double MinimalLot=0; MinimalLot=MarketInfo(S,MODE_MINLOT); if(MinimalLotlt;=0) { RefreshRates(); return(-1); } value=MathFloor(P/MinimalLot)*MinimalLot; return(value); }/ ------------------------------------------------------------------ /| Linear closing of position |/ ------------------------------------------------------------------ void PartialClosingExe() { int Profit=0; if(OrderType()==OP_BUY) Profit=MathRound((Bid-OrderOpenPrice())/Point); if(OrderType()==OP_SELL) Profit=MathRound((OrderOpenPrice()-Ask)/Point); if(Profitlt;=0) return; int PipStep=MathFloor(TakeProfit/TPDivide); if(PipSteplt;1) PipStep=1; if(PipStepgt;TakeProfit) PipStep=TakeProfit; double LotPercent=1.00/TPDivide; if(LotPercentgt;1.00) LotPercent=1.00; if(TPDividegt;TakeProfit TakeProfitgt;0) LotPercent=1.00/TakeProfit; double FirstPosition=LotsRisk(StopLoss); double CutLots=FirstPosition*LotPercent*MathFloor(Profit/PipStep); CutLots=RoundLots(Symbol(),CutLots); if(CutLotslt;=0) return; CutLots=CutLots-(FirstPosition-OrderLots()); if(CutLotslt;=0) return; if(OrderLots()lt;CutLots) CutLots=OrderLots(); if(OrderType()==OP_BUY) OrderClose(OrderTicket(),CutLots,Bid,slippage,Whit e); if(OrderType()==OP_SELL) OrderClose(OrderTicket(),CutLots,Ask,slippage,Whit e); return; } void start() { static datetime TradeOpenBar; /---- check for history and trading if(Barslt;100 || IsTradeAllowed()==false) return; /---- check for signals CheckForSignals(TradeOpenBar); /---- calculate open orders by current symbol if (CalculateCurrentOrders(Symbol())==0) TradeOpenBar = CheckForOpen(TradeOpenBar); else CheckForClose(); BreakEvenStop(); TrailingStop(); }/ ------------------------------------------------------------------

  2.                         
    Publicidad
  3. #2
    1 Adjunto(s) adjunto(s) el .ex4, cópielo a su carpeta de indicadores (¡solo el .ex4, no un mq4!), también hice algunas modificaciones (agregué la opción para ajustar pips/puntos, cambié algunos tipos de variables de int a double, eliminó los diversos comandos de suspensión, agregó comprobaciones de contexto comercial ocupado, etc.).
    https://www.forosforex.com/attachmen...526.EURUSD M15

  4. #3
    1 Adjunto(s) adjunto(s) v1.1, hice las velas de señal externas y actualicé un poco el ea (por ejemplo, con la función tradinghours de steve hopwood y baluda)
    https://www.forosforex.com/attachmen...564.EURUSD M15

Permisos de publicación

  • No puedes crear nuevos temas
  • No puedes responder temas
  • No puedes subir archivos adjuntos
  • No puedes editar tus mensajes
  •  
Uso de cookies
Utilizamos cookies propias y de terceros para elaborar información estadística y mostrarle publicidad personalizada a través del análisis de su navegación. Si continúa navegando acepta su uso. Más información y política de cookies.
     

Aviso legal: Ni forosforex.com ni ninguna persona involucrada en forosforex.com aceptarán ninguna responsabilidad por cualquier pérdida o daño en el trading como resultado de la confianza en la información contenida en este sitio web, incluidos datos, cotizaciones, gráficos y señales de compra/venta. Por favor, infórmese plenamente de los riesgos y costes asociados a las operaciones en los mercados financieros, una de las formas de inversión que más riesgos entrañan.
forosforex.com le quiere recordar que los datos contenidos en este sitio web no son necesariamente en tiempo real ni exactos. forosforex.com no asume responsabilidad alguna por las pérdidas en que usted podría incurrir como resultado de la utilización de estos datos. Este acuerdo se rige por su versión en inglés, que prevalecerá siempre que haya alguna discrepancia entre la versión en inglés y la versión en español. Los CFD son un producto difícil de entender, varios organismos reguladores consideran que no es adecuado para inversores minoristas debido a su complejidad y riesgo.
Advertencia de riesgo: Los CFDs son un producto difícil de entender, y puede no ser adecuado para inversores minoristas debido a su complejidad y riesgo. Existe la posibilidad de sufrir una pérdida igual o superior a la inversión. Por lo tanto, no debe invertir o arriesgar dinero que no pueda permitirse perder. Debe asegurarse de que comprende todos los riesgos. Antes de abrir una cuenta en un broker por favor sea consciente e infórmese de los riesgos asociados con el trading. El contenido de este sitio web no debe interpretarse como asesoramiento personal. ForosForex recomienda que busque el consejo de un asesor financiero independiente.