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
(291)
Proyectos
468
39%
Arbitraje
101
41% / 23%
Caducado
76
16%
Ocupado
Ha publicado: 2 ejemplos
2
Desarrollador 2
Evaluación
(78)
Proyectos
117
47%
Arbitraje
7
14% / 29%
Caducado
11
9%
Libre
Solicitudes similares
Necesito el desarrollo de un Expert Advisor (EA) para MetaTrader 4 con integración del motor ABBYY OCR. El EA debe: - Capturar información visual (pantalla / ventana específica) - Procesar el texto mediante ABBYY OCR Engine - Interpretar señales extraídas - Ejecutar operaciones automáticas en MT4 según reglas definidas Requisitos técnicos: - Integración estable entre MT4 y ABBYY (DLL / API / bridge externo) - Código
Necesito un robot (Expert Advisor) para MetaTrader 5 que opere de manera totalmente automática con las siguientes características: 1. Capital inicial: 10 USD. 2. Meta diaria de ganancias: 100 USD. 3. Cuando alcance los 100 USD de ganancia, el robot debe DETENERSE automáticamente hasta el siguiente día. 4. Debe abrir múltiples operaciones de compra y venta durante el día. 5. Puede usar cualquier estrategia segura
Desarrollar un EA automático para MT5 que opere únicamente en pares principales de Forex y XAUUSD. 2. Integrar la estrategia SMC + ICT, incluyendo: Detección de estructura del mercado (BOS / CHoCH). Identificación de zonas de liquidez y barrido de stops. Reconocimiento de retrocesos Fibonacci en M15 para entradas precisas. 3. Configurar gestión de riesgo automática: SL/TP configurables y tamaño de lote dinámico según
Se solicita el desarrollo de un Expert Advisor (EA) para MetaTrader 5, diseñado para operar exclusivamente en XAUUSDm (Oro) en el broker Exness. El EA debe integrar una estrategia de trading clara, completa y predefinida, orientada a escalar una cuenta desde 50 USD hasta más de 1500 USD

Información sobre el proyecto

Presupuesto
40+ USD