Ayuda con duda de programación

 
como es el codigo fuente para hacer autolotaje y martingala en mt5?? alguien me puede ayudar??
 
alguien sabe nr.de tel.de servicio técnico de mt5?

 
Jelson Machacon:
como es el codigo fuente para hacer autolotaje y martingala en mt5?? alguien me puede ayudar??
if(*Condition*){LotSize=NormalizeDouble(LotSize*Martingale,2);}

Trabájatelo y acabará saliendo.

De nada.

 
Jelson Machacon:
como es el codigo fuente para hacer autolotaje y martingala en mt5?? alguien me puede ayudar??
//+------------------------------------------------------------------+
//|                              Ejemplo de martingala para el foro  |
//|                              Copyright 2021, Enrique Enguix Viño |
//|                              https://www.mql5.com/es/users/envex |
//+------------------------------------------------------------------+
#property copyright "Copyright 2021, Enrique Enguix Viño"
#property link      "https://www.mql5.com/es/users/envex"
#property version   "1.00"
#property description ""


int LotDigits; //initialized in OnInit
int MagicNumber = 1530079;
double MM_Martingale_Start = 0.1;
double MM_Martingale_ProfitFactor = 1;
double MM_Martingale_LossFactor = 2;
bool MM_Martingale_RestartProfit = true;
bool MM_Martingale_RestartLoss = false;
int MM_Martingale_RestartLosses = 1000;
int MM_Martingale_RestartProfits = 1000;
int MaxSlippage = 3; //slippage, adjusted in OnInit
int MaxSlippage_;
double myPoint; //initialized in OnInit

double MM_Size() //martingale / anti-martingale
  {
   double lots = MM_Martingale_Start;
   double MaxLot = SymbolInfoDouble(Symbol(), SYMBOL_VOLUME_MAX);
   double MinLot = SymbolInfoDouble(Symbol(), SYMBOL_VOLUME_MIN);
   ulong ticket = 0;
   if((ticket = LastHistoryTradeTicket(DEAL_ENTRY_OUT)) > 0)
     {
      if(HistoryDealGetDouble(ticket, DEAL_PROFIT) > 0 && !MM_Martingale_RestartProfit)
         lots = HistoryDealGetDouble(ticket, DEAL_VOLUME) * MM_Martingale_ProfitFactor;
      else if(HistoryDealGetDouble(ticket, DEAL_PROFIT) < 0 && !MM_Martingale_RestartLoss)
         lots = HistoryDealGetDouble(ticket, DEAL_VOLUME) * MM_Martingale_LossFactor;
      else if(HistoryDealGetDouble(ticket, DEAL_PROFIT) == 0)
         lots = HistoryDealGetDouble(ticket, DEAL_VOLUME);
     }
   if(ConsecutivePL(false, MM_Martingale_RestartLosses))
      lots = MM_Martingale_Start;
   if(ConsecutivePL(true, MM_Martingale_RestartProfits))
      lots = MM_Martingale_Start;
   if(lots > MaxLot) lots = MaxLot;
   if(lots < MinLot) lots = MinLot;
   return(lots);
  }

ulong LastHistoryTradeTicket(int deal_io)
  {
   HistorySelect(0, TimeCurrent());
   int total = HistoryDealsTotal();
   ulong ticket = 0;
   for(int i = total-1; i >= 0; i--)
     {
      if((ticket = HistoryDealGetTicket(i)) <= 0) continue;
      if(HistoryDealGetString(ticket, DEAL_SYMBOL) == Symbol()
      && HistoryDealGetInteger(ticket, DEAL_MAGIC) == MagicNumber
      && HistoryDealGetInteger(ticket, DEAL_TYPE) <= 1 && HistoryDealGetInteger(ticket, DEAL_ENTRY) == deal_io)
         return(ticket);
     } 
   return(0);
  }

bool ConsecutivePL(bool profits, int n)
  {
   int count = 0;
   HistorySelect(0, TimeCurrent());
   int total = HistoryDealsTotal();
   ulong ticket = 0;
   for(int i = total-1; i >= 0; i--)
     {
      if((ticket = HistoryDealGetTicket(i)) <= 0) continue;
      if(HistoryDealGetString(ticket, DEAL_SYMBOL) == Symbol()
      && HistoryDealGetInteger(ticket, DEAL_TYPE) <= 1 && HistoryDealGetInteger(ticket, DEAL_ENTRY) == DEAL_ENTRY_OUT)
       {
         if((!profits && HistoryDealGetDouble(ticket, DEAL_PROFIT) >= 0) || (profits && HistoryDealGetDouble(ticket, DEAL_PROFIT) <= 0))
            break;
         count++;
       }
     }
   return(count >= n);
  }

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {   
   MaxSlippage_ = MaxSlippage;
   //initialize myPoint
   myPoint = Point();
   if(Digits() == 5 || Digits() == 3)
     {
      myPoint *= 10;
      MaxSlippage_ *= 10;
     }
   //initialize LotDigits
   double LotStep = SymbolInfoDouble(Symbol(), SYMBOL_VOLUME_STEP);
   if(NormalizeDouble(LotStep, 3) == round(LotStep))
      LotDigits = 0;
   else if(NormalizeDouble(10*LotStep, 3) == round(10*LotStep))
      LotDigits = 1;
   else if(NormalizeDouble(100*LotStep, 3) == round(100*LotStep))
      LotDigits = 2;
   else LotDigits = 3;
   return(INIT_SUCCEEDED);
  }

//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
  }

//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
   ulong ticket = 0;
   double price;   
   
  }
//+------------------------------------------------------------------+
 
Enrique Enguix Vino #:

Creo que es el peor ejemplo de martingala que he visto.

Por este tipo de cosas es conveniente saber inglés.

 
David Diez #:

Creo que es el peor ejemplo de martingala que he visto.

Por este tipo de cosas es conveniente saber inglés.

Supongo que te refieres al tuyo
Si te refieres al mío, estaría bien que nos dijeras por qué, así todos tenemos la oportunidad de aprender algo 
 
Enrique Enguix Vino #:
Supongo que te refieres al tuyo
Si te refieres al mío, estaría bien que nos dijeras por qué, así todos tenemos la oportunidad de aprender algo 
Tu código es un ladrillo, Enrique.
Sólo eso, que nadie se ofenda.
 

No os calentéis, es código generado vía Eabuilder.

¡Felices fiestas!

 
Perfecto, vaya nivel.
Esto hace dos años no pasaba.
Y luego quieren que la gente aprenda.

 
David Diez #:
Tu código es un ladrillo, Enrique.
Sólo eso, que nadie se ofenda.

Si no quieres que nadie se ofenda, no digas cosas ofensivas.

Una cosa es que alguien pida un poco de ayuda en algún problema puntual, y otra es que pidan el trabajo hecho. 

Creo que Enrique ha hecho muchísimo pasándole un código entero para que pueda empezar a trabajar.

El depurarlo y mejorarlo ya es responsabilidad del desarrollador.

 
Miquel Cirera Mato #:

Si no quieres que nadie se ofenda, no digas cosas ofensivas.

Una cosa es que alguien pida un poco de ayuda en algún problema puntual, y otra es que pidan el trabajo hecho. 

Creo que Enrique ha hecho muchísimo pasándole un código entero para que pueda empezar a trabajar.

El depurarlo y mejorarlo ya es responsabilidad del desarrollador.

Muy bien gentil caballero pero yo ya me he disculpado. Que paséis buena tarde.