Asesoría para convertir un programa de MQL4 a MQL5

Trabajo finalizado

Plazo de ejecución 2 días
Comentario del Cliente
Excelente resolvió mi problema en muy poco tiempo. espero trabajar con el de nuevo.

Tarea técnica

quiero convertir un programa y necesito asesoria para la conversion y aprender.

quiero mantener el mismo formato tanto como sea posible .

son varias funciones a convertir dejo ejemlo de una funcion.

bool Buy(int MagicIndex, double Lots, int StopLossMethod, double StopLossPoints, int TakeProfitMethod, double TakeProfitPoints, int Slippage, int MaxOpenTrades,
         int MaxFrequencyMins, string TradeComment)
{
   static double pipSize = 0;   
   if(pipSize == 0) pipSize = Point * (1 + 9 * (Digits == 3 || Digits == 5));

   double sl = 0, tp = 0;
   double stopLossPoints = 0, takeProfitPoints = 0;
   
   int numberOfOpenTrades = 0;
   
   for(int i=OrdersTotal()-1;i>=0;i--){
      if(!OrderSelect(i, SELECT_BY_POS)) continue;
      if(OrderMagicNumber() != __STRATEGY_MAGIC + MagicIndex || OrderSymbol() != Symbol()) continue;
      numberOfOpenTrades ++;    
   }   

   if(MaxOpenTrades > 0 && numberOfOpenTrades >= MaxOpenTrades) return(false);       
  
   if(MaxFrequencyMins  > 0)
   {   
      int recentSeconds = MaxFrequencyMins * 60;

      for(int i=OrdersTotal()-1;i>=0;i--){
         if(!OrderSelect(i, SELECT_BY_POS)) continue;
         if(OrderMagicNumber() != __STRATEGY_MAGIC + MagicIndex || OrderSymbol() != Symbol()) continue;
         if(TimeCurrent() - OrderOpenTime() < recentSeconds) return(false);
      }  

      int hstTotal=OrdersHistoryTotal();
   
      for(int i=hstTotal-1;i>=0;i--)
      {  
         if(!OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)) continue;
         if(OrderMagicNumber() != __STRATEGY_MAGIC + MagicIndex || OrderSymbol() != Symbol()) continue;      
         if(TimeCurrent() - OrderOpenTime() < recentSeconds) return(false);
         break;            
      }  
   }
   
   if(Lots < MarketInfo(Symbol(),MODE_MINLOT)) return(false);
   
   if(AccountFreeMarginCheck(Symbol(), OP_SELL,Lots) <= 0) {
      Print("Buy error: insufficient capital");
      return(false);
   }   

   if (StopLossPoints > 0)
   {
      if(StopLossMethod == 0)
      {
         sl = NormalizeDouble(Ask - StopLossPoints * Point, Digits);
         stopLossPoints = StopLossPoints;
      }
      else if (StopLossMethod == 1)
      {
         sl = NormalizeDouble(Ask - StopLossPoints * pipSize, Digits);
         stopLossPoints = StopLossPoints * (1 + 9 * (Digits == 3 || Digits == 5));
      }
      else
      {
         sl  = StopLossPoints;
         stopLossPoints = (Ask - sl)/Point; 
      }
   }
   
   if (TakeProfitPoints > 0)
   {
      if(TakeProfitMethod == 0)
      {
         tp = NormalizeDouble(Ask + TakeProfitPoints * Point, Digits);
         takeProfitPoints = TakeProfitPoints;
      }
      else if (TakeProfitMethod == 1)
      {
         tp = NormalizeDouble(Ask + TakeProfitPoints * pipSize, Digits);
         takeProfitPoints = TakeProfitPoints * (1 + 9 * (Digits == 3 || Digits == 5));
      }
      else
      {
         tp = TakeProfitPoints;
         takeProfitPoints = (tp - Ask)/Point; 
      }
   }  
   
   double stopLevel = MarketInfo(Symbol(),MODE_STOPLEVEL) + MarketInfo(Symbol(),MODE_SPREAD);
   
   if( (sl > 0 && stopLossPoints <= stopLevel) || (tp > 0 && takeProfitPoints <= stopLevel) )
   {
      Print("Cannot Buy: Stop loss and take profit must be at least " 
      + DoubleToStr(MarketInfo(Symbol(),MODE_STOPLEVEL) + MarketInfo(Symbol(),MODE_SPREAD),0) 
      + " points away from the current price");
      return (false);
   }
          
   RefreshRates();
        int result = OrderSend(Symbol(), OP_BUY, Lots, Ask, Slippage, sl, tp, " " + "(" + WindowExpertName() + ") " + TradeComment, __STRATEGY_MAGIC + MagicIndex);
        
        if (result == -1){
                Print("Failed to Buy: " + IntegerToString(GetLastError()));
                Sleep(__SLEEP_AFTER_EXECUTION_FAIL);
           return(false); 
        }
         
   return(true); 
}


Han respondido

1
Desarrollador 1
Evaluación
(256)
Proyectos
415
38%
Arbitraje
86
44% / 19%
Caducado
70
17%
Ocupado
2
Desarrollador 2
Evaluación
(78)
Proyectos
117
47%
Arbitraje
7
14% / 29%
Caducado
11
9%
Libre
Solicitudes similares
Hola, soy programador y tengo un problema con el bot, consegui todo menos que logre leer bien las señales de compra o de venta de mi .txt, entonces necesito ayuda para hacer funcionar al bot
Necesito agregar una alerta sonora y de flechas al indicador ADX. La alerta sonora y de flechas debe arrojar cuando la linea del ADX cruce un nivel configurable en parámetros de entrada, ademas deberá tener la opcion de activarla o no y de color y tamaño de flechas
Gongs 50 - 200 USD
Ejemplo necesitamos construir un indicador Zigzag cuyos extremos definiremos con la ayuda de un oscilador. Serviría cualquier oscilador normativo clásico para el que exita un concepto sobre zonas de sombrecompra o sobre venta.En primer lugar necesitamos algoritmo con el indicador WPR, luego añadimos de forma análoga la posibilidad de construir
Necesito dos bots. 1un bot de HFT para mt5 que sirva para empresas de fondeo y que supere los exámenes de hft. 2. Un bot para operar en real en cuentas no hft, ejemplo FTMO. Compro el primerl. Si muedtro conformidad con el producto encargo el segundo y un tercero mas
Software flash usdt 300 - 400 USD
Necesito alguien que desarrolle un software portátil de flash usdt que permita enviar flash diario sin límites y que pase cualquier billetera sea binance , trush wallet, coinbase bueno todas
Actualmente estoy usando un asesor experto de MetaTrader 4 para operar, pero he notado que no maneja bien los períodos de noticias. Necesito un desarrollador competente para replicar este EA con un ajuste crítico: debe evitar operar durante las horas de noticias, como lo indica un indicador de noticias específico.( solo tengo el EA en formato EX4) Requisitos clave: - El EA no debe realizar ningún pedido nuevo a

Información sobre el proyecto

Presupuesto
40+ USD
Para el ejecutor
36 USD