CustomTicksReplace

Sustituye totalmente la historia de precios del instrumento personalizado en el intervalo temporal indicado, con los datos de la matriz del tipo MqlTick.

int  CustomTicksReplace(
   const string     symbol,            // nombre del símbolo
   long             from_msc,          // desde qué fecha
   long             to_msc,            // hasta qué fecha
   const MqlTick&   ticks[],           // matriz con los datos de ticks que necesitamos aplicar al instrumento personalizado
   uint             count=WHOLE_ARRAY  // número de elementos que se usarán de la matriz ticks[]
   );

Parámetros

symbol

[in]  Nombre del instrumento personalizado.

from_msc

[in]  Hora del primer tick en la historia de precio del diapasón indicado, que debe ser eliminado. Hora en milisegundos desde el 01.01.1970.

to_msc

[in]  Hora del último tick en la historia de precio del diapasón indicado, que debe ser eliminado. Hora en milisegundos desde el 01.01.1970.

ticks[]

[in]   Matriz de los datos de ticks del tipo MqlTick, organizados en orden temporalmente ascendente.

count=WHOLE_ARRAY

[in]  Número de elementos de la matriz ticks[] que se usarán para la sustitución en el intervalo de tiempo indicado. El valor WHOLE_ARRAY indica que se debe usar todos los elementos de la matriz ticks[].

Valor devuelto

Número de ticks actualizados o bien -1 en caso de error.

Nota

Puesto que en el flujo de cotizaciones no es raro que varios ticks tengan la misma hora con una precisión de milisegundos (la hora exacta del tick se guarda en el campo time_msc de la estructura MqlTick), la función CustomTicksReplace no realiza la clasificación automática de los elementos de la matriz ticks[] por hora. Por eso, la matriz de ticks debe ordenarse preliminarmente de forma temporalmente ascendente.

La sustitución de los ticks se realiza de forma consecutiva un día detrás otro hasta la hora indicada en to_msc o bien hasta el momento de aparición de un error. Primero se procesa el primer día del diapasón indicado, después el siguiente, y así sucesivamente.  En cuanto se detecte una discordancia de la hora del tick con respecto al orden ascendente (no decreciente), el proceso de sustitución de ticks se interrumpirá de inmediato en el día actual. En este caso, además, los ticks de los días anteriores se sustituirán con éxito, mientras que el día actual (en el momento del tick incorrecto) y el resto de los días en el intervalo indicado permanecerán sin cambios.

Si en la matriz ticks[] no hay datos de ticks disponibles de algún día (en general, de una longitud cualquiera), después de aplicar los datos de ticks de ticks[] en la historia del instrumento personalizado se forma un "agujero", que se corresponde con los datos omitidos. En otras palabras, la llamada de CustomTicksReplace con ticks cortados en un intervalo concreto será equivalente a la eliminación de una parte de la historia de ticks, como si se llamara CustomTicksDelete con el intervalo "agujero".

Si no existen datos del intervalo de tiempo indicado en la base de ticks, CustomTicksReplace sencillamente añadirá a ella los ticks de la matriz ticks[].

La función CustomTicksReplace trabaja directamente con la base de datos de ticks.

 

Ejemplo:

//+------------------------------------------------------------------+
//|                                           CustomTicksReplace.mq5 |
//|                                  Copyright 2024, MetaQuotes Ltd. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2024, MetaQuotes Ltd."
#property link      "https://www.mql5.com"
#property version   "1.00"
 
#define   CUSTOM_SYMBOL_NAME     Symbol()+".C"     // nombre del símbolo personalizado
#define   CUSTOM_SYMBOL_PATH     "Forex"           // nombre del grupo en el que se creará el símbolo
#define   CUSTOM_SYMBOL_ORIGIN   Symbol()          // nombre del símbolo a partir del cual se creará el símbolo personalizado
 
#define   DATATICKS_TO_COPY      UINT_MAX          // cantidad de ticks copiados
#define   DATATICKS_TO_PRINT     20                // cantidad de ticks a mostrar en el registro
 
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//--- obtenemos el código de error al crear un símbolo personalizado
   int create=CreateCustomSymbol(CUSTOM_SYMBOL_NAMECUSTOM_SYMBOL_PATHCUSTOM_SYMBOL_ORIGIN);
   
//--- si el código de error no es 0 (el símbolo se ha creado con éxito) y no es 5304 (símbolo ya creado), salimos.
   if(create!=0 && create!=5304)
      return;
 
//--- obtenemos en la matriz MqlTick los datos de los ticks del símbolo estándar
   MqlTick array[]={};
   if(!GetTicksToArray(CUSTOM_SYMBOL_ORIGINDATATICKS_TO_COPYarray))
      return;
   
//--- imprimimos la hora del primer y el último tick obtenidos del símbolo estándar
   int total=(int)array.Size();
   PrintFormat("First tick time: %s.%03u, Last tick time: %s.%03u",
               TimeToString(array[0].time,TIME_DATE|TIME_MINUTES|TIME_SECONDS), array[0].time_msc%1000,
               TimeToString(array[total-1].timeTIME_DATE|TIME_MINUTES|TIME_SECONDS), array[total-1].time_msc%1000);
               
//--- imprimimos en el registro DATATATICKS_TO_PRINT los últimos ticks del símbolo estándar
   PrintFormat("\nThe last %d ticks for the standard symbol '%s':"DATATICKS_TO_PRINTCUSTOM_SYMBOL_ORIGIN);
   for(int i=total-DATATICKS_TO_PRINTi<totali++)
     {
      if(i<0)
         continue;
      PrintFormat("  %dth Tick: %s"iGetTickDescription(array[i]));
     }
   
//--- añadimos el símbolo personalizado a la ventana MarketWatch (observación de mercado)
   ResetLastError();
   if(!SymbolSelect(CUSTOM_SYMBOL_NAMEtrue))
     {
      Print("SymbolSelect() failed. Error "GetLastError());
      return;
     }
     
//--- añadimos a la historia de precios del símbolo personalizado los datos de la matriz de ticks
   Print("...");
   uint start=GetTickCount();
   PrintFormat("Start of adding %u ticks to the history of the custom symbol '%s'"array.Size(), CUSTOM_SYMBOL_NAME);
   int added=CustomTicksAdd(CUSTOM_SYMBOL_NAMEarray);
   PrintFormat("Added %u ticks to the history of the custom symbol '%s' in %u ms"addedCUSTOM_SYMBOL_NAMEGetTickCount()-start);
   
//--- obtenemos en la matriz MqlTick los datos de los ticks del símbolo personalizado recién obtenidos
   Print("...");
   if(!GetTicksToArray(CUSTOM_SYMBOL_NAMEarray.Size(), array))
      return;
   
//--- imprimimos la hora del primer y el último tick obtenidos del símbolo personalizado
   total=(int)array.Size();
   PrintFormat("First tick time: %s.%03u, Last tick time: %s.%03u",
               TimeToString(array[0].timeTIME_DATE|TIME_MINUTES|TIME_SECONDS), array[0].time_msc%1000,
               TimeToString(array[total-1].timeTIME_DATE|TIME_MINUTES|TIME_SECONDS), array[total-1].time_msc%1000);
               
//--- imprimimos en el registro DATATATICKS_TO_PRINT los últimos ticks del símbolo personalizado
   PrintFormat("\nThe last %d ticks for the custom symbol '%s':"DATATICKS_TO_PRINTCUSTOM_SYMBOL_NAME);
   for(int i=total-DATATICKS_TO_PRINTi<totali++)
     {
      if(i<0)
         continue;
      PrintFormat("  %dth Tick: %s"iGetTickDescription(array[i]));
     }
 
//--- ahara cambiamos los valores Ask y Bid de los ticks en la matriz según la fórmula Ask(Symbol) = 1.0 / Ask(Symbol), Bid(Symbol) = 1.0 / Bid(Symbol)
   for(int i=0i<totali++)
     {
      array[i].ask = (array[i].ask !=0 ? 1.0 / array[i].ask : array[i].ask);
      array[i].bid = (array[i].bid !=0 ? 1.0 / array[i].bid : array[i].bid);
     }
   Print("\nNow the ticks are changed");
 
//--- sustituimos la historia de ticks del símbolo personalizado por los datos de la matriz de ticks modificada
   Print("...");
   start=GetTickCount();
   PrintFormat("Start replacing %u changed ticks in the history of the custom symbol '%s'"array.Size(), CUSTOM_SYMBOL_NAME);
   int replaced=CustomTicksReplace(CUSTOM_SYMBOL_NAMEarray[0].time_mscarray[total-1].time_mscarray);
   PrintFormat("Replaced %u ticks in the history of the custom symbol '%s' in %u ms"replacedCUSTOM_SYMBOL_NAMEGetTickCount()-start);
   
//--- obtenemos en la matriz MqlTick los datos de los ticks del símbolo personalizado recién sustituidos
   Print("...");
   if(!GetTicksToArray(CUSTOM_SYMBOL_NAMEarray.Size(), array))
      return;
   
//--- imprimimos la hora del primer y el último tick modificados del símbolo personalizado
   total=(int)array.Size();
   PrintFormat("First changed tick time: %s.%03u, Last changed tick time: %s.%03u",
               TimeToString(array[0].timeTIME_DATE|TIME_MINUTES|TIME_SECONDS), array[0].time_msc%1000,
               TimeToString(array[total-1].timeTIME_DATE|TIME_MINUTES|TIME_SECONDS), array[total-1].time_msc%1000);
               
//--- imprimimos en el registro DATATATICKS_TO_PRINT los últimos ticks modificados del símbolo personalizado
   PrintFormat("\nThe last %d changed ticks for the custom symbol '%s':"DATATICKS_TO_PRINTCUSTOM_SYMBOL_NAME);
   for(int i=total-DATATICKS_TO_PRINTi<totali++)
     {
      if(i<0)
         continue;
      PrintFormat("  %dth Changed tick: %s"iGetTickDescription(array[i]));
     }
 
//--- mostramos en el gráfico en el comentario la pista sobre las teclas de finalización del script
   Comment(StringFormat("Press 'Esc' to exit or 'Del' to delete the '%s' symbol and exit"CUSTOM_SYMBOL_NAME));
//--- en un ciclo infinito esperamos que Esc o Del para la salida
   while(!IsStopped() && TerminalInfoInteger(TERMINAL_KEYSTATE_ESCAPE)==0)
     {
      Sleep(16);
      //--- al presionar Supr, eliminamos el símbolo personalizado creado y sus datos
      if(TerminalInfoInteger(TERMINAL_KEYSTATE_DELETE)<0)
        {
         //--- eliminamos los datos de las barras
         int deleted=CustomRatesDelete(CUSTOM_SYMBOL_NAME0LONG_MAX);
         if(deleted>0)
            PrintFormat("%d history bars of the custom symbol '%s' were successfully deleted"deletedCUSTOM_SYMBOL_NAME);
         
         //--- eliminamos los datos de ticks
         deleted=CustomTicksDelete(CUSTOM_SYMBOL_NAME0LONG_MAX);
         if(deleted>0)
            PrintFormat("%d history ticks of the custom symbol '%s' were successfully deleted"deletedCUSTOM_SYMBOL_NAME);
         
         //--- eliminamos el símbolo
         if(DeleteCustomSymbol(CUSTOM_SYMBOL_NAME))
            PrintFormat("Custom symbol '%s' deleted successfully"CUSTOM_SYMBOL_NAME);
         break;
        }
     }
//--- antes de la salida, limpiamos el gráfico
   Comment("");
   /*
   resultado:
   Requested 4294967295 ticks to get tick history for the symbol 'EURUSD'
   The tick history for the 'EURUSDsymbol is received in the amount of 351195822 ticks in 55735 ms
   First tick time2011.12.19 00:00:08.000Last tick time2024.06.21 08:39:03.113
   
   The last 20 ticks for the standard symbol 'EURUSD':
     351195802th Tick2024.06.21 08:38:10.076 Ask=1.07194 (Info tick)
     351195803th Tick2024.06.21 08:38:13.162 Ask=1.07195 (Info tick)
     351195804th Tick2024.06.21 08:38:13.872 Bid=1.07195 (Info tick)
     351195805th Tick2024.06.21 08:38:14.866 Ask=1.07194 Bid=1.07194 (Info tick)
     351195806th Tick2024.06.21 08:38:17.374 Bid=1.07194 (Info tick)
     351195807th Tick2024.06.21 08:38:18.883 Bid=1.07194 (Info tick)
     351195808th Tick2024.06.21 08:38:19.771 Bid=1.07194 (Info tick)
     351195809th Tick2024.06.21 08:38:20.873 Ask=1.07195 Bid=1.07195 (Info tick)
     351195810th Tick2024.06.21 08:38:22.278 Ask=1.07196 Bid=1.07196 (Info tick)
     351195811th Tick2024.06.21 08:38:22.775 Bid=1.07196 (Info tick)
     351195812th Tick2024.06.21 08:38:23.477 Bid=1.07196 (Info tick)
     351195813th Tick2024.06.21 08:38:38.194 Ask=1.07197 (Info tick)
     351195814th Tick2024.06.21 08:38:38.789 Ask=1.07196 (Info tick)
     351195815th Tick2024.06.21 08:38:39.290 Ask=1.07197 (Info tick)
     351195816th Tick2024.06.21 08:38:43.695 Ask=1.07196 (Info tick)
     351195817th Tick2024.06.21 08:38:52.203 Ask=1.07195 Bid=1.07195 (Info tick)
     351195818th Tick2024.06.21 08:38:55.105 Ask=1.07196 Bid=1.07196 (Info tick)
     351195819th Tick2024.06.21 08:38:57.607 Ask=1.07195 Bid=1.07195 (Info tick)
     351195820th Tick2024.06.21 08:39:00.512 Ask=1.07196 Bid=1.07196 (Info tick)
     351195821th Tick2024.06.21 08:39:03.113 Ask=1.07195 Bid=1.07195 (Info tick)
   ...
   Start of adding 351195822 ticks to the history of the custom symbol 'EURUSD.C'
   Added 351195822 ticks to the history of the custom symbol 'EURUSD.Cin 349407 ms
   ...
   Requested 351195822 ticks to get tick history for the symbol 'EURUSD.C'
   The tick history for the 'EURUSD.Csymbol is received in the amount of 351195822 ticks in 190203 ms
   First tick time2011.12.19 00:00:08.000Last tick time2024.06.21 08:39:03.113
   
   The last 20 ticks for the custom symbol 'EURUSD.C':
     351195802th Tick2024.06.21 08:38:10.076 Ask=1.07194 Bid=1.07194 (Info tick)
     351195803th Tick2024.06.21 08:38:13.162 Ask=1.07195 Bid=1.07195 (Info tick)
     351195804th Tick2024.06.21 08:38:13.872 Ask=1.07195 Bid=1.07195 (Info tick)
     351195805th Tick2024.06.21 08:38:14.866 Ask=1.07194 Bid=1.07194 (Info tick)
     351195806th Tick2024.06.21 08:38:17.374 Ask=1.07194 Bid=1.07194 (Info tick)
     351195807th Tick2024.06.21 08:38:18.883 Ask=1.07194 Bid=1.07194 (Info tick)
     351195808th Tick2024.06.21 08:38:19.771 Ask=1.07194 Bid=1.07194 (Info tick)
     351195809th Tick2024.06.21 08:38:20.873 Ask=1.07195 Bid=1.07195 (Info tick)
     351195810th Tick2024.06.21 08:38:22.278 Ask=1.07196 Bid=1.07196 (Info tick)
     351195811th Tick2024.06.21 08:38:22.775 Ask=1.07196 Bid=1.07196 (Info tick)
     351195812th Tick2024.06.21 08:38:23.477 Ask=1.07196 Bid=1.07196 (Info tick)
     351195813th Tick2024.06.21 08:38:38.194 Ask=1.07197 Bid=1.07197 (Info tick)
     351195814th Tick2024.06.21 08:38:38.789 Ask=1.07196 Bid=1.07196 (Info tick)
     351195815th Tick2024.06.21 08:38:39.290 Ask=1.07197 Bid=1.07197 (Info tick)
     351195816th Tick2024.06.21 08:38:43.695 Ask=1.07196 Bid=1.07196 (Info tick)
     351195817th Tick2024.06.21 08:38:52.203 Ask=1.07195 Bid=1.07195 (Info tick)
     351195818th Tick2024.06.21 08:38:55.105 Ask=1.07196 Bid=1.07196 (Info tick)
     351195819th Tick2024.06.21 08:38:57.607 Ask=1.07195 Bid=1.07195 (Info tick)
     351195820th Tick2024.06.21 08:39:00.512 Ask=1.07196 Bid=1.07196 (Info tick)
     351195821th Tick2024.06.21 08:39:03.113 Ask=1.07195 Bid=1.07195 (Info tick)
   
   Now the ticks are changed
   ...
   Start replacing 351195822 changed ticks in the history of the custom symbol 'EURUSD.C'
   Replaced 351195822 ticks in the history of the custom symbol 'EURUSD.Cin 452266 ms
   ...
   Requested 351195822 ticks to get tick history for the symbol 'EURUSD.C'
   The tick history for the 'EURUSD.Csymbol is received in the amount of 351195822 ticks in 199812 ms
   First changed tick time2011.12.19 00:00:08.000Last changed tick time2024.06.21 08:39:03.113
   
   The last 20 changed ticks for the custom symbol 'EURUSD.C':
     351195802th Changed tick2024.06.21 08:38:10.076 Ask=0.93289 Bid=0.93289 (Info tick)
     351195803th Changed tick2024.06.21 08:38:13.162 Ask=0.93288 Bid=0.93288 (Info tick)
     351195804th Changed tick2024.06.21 08:38:13.872 Ask=0.93288 Bid=0.93288 (Info tick)
     351195805th Changed tick2024.06.21 08:38:14.866 Ask=0.93289 Bid=0.93289 (Info tick)
     351195806th Changed tick2024.06.21 08:38:17.374 Ask=0.93289 Bid=0.93289 (Info tick)
     351195807th Changed tick2024.06.21 08:38:18.883 Ask=0.93289 Bid=0.93289 (Info tick)
     351195808th Changed tick2024.06.21 08:38:19.771 Ask=0.93289 Bid=0.93289 (Info tick)
     351195809th Changed tick2024.06.21 08:38:20.873 Ask=0.93288 Bid=0.93288 (Info tick)
     351195810th Changed tick2024.06.21 08:38:22.278 Ask=0.93287 Bid=0.93287 (Info tick)
     351195811th Changed tick2024.06.21 08:38:22.775 Ask=0.93287 Bid=0.93287 (Info tick)
     351195812th Changed tick2024.06.21 08:38:23.477 Ask=0.93287 Bid=0.93287 (Info tick)
     351195813th Changed tick2024.06.21 08:38:38.194 Ask=0.93286 Bid=0.93286 (Info tick)
     351195814th Changed tick2024.06.21 08:38:38.789 Ask=0.93287 Bid=0.93287 (Info tick)
     351195815th Changed tick2024.06.21 08:38:39.290 Ask=0.93286 Bid=0.93286 (Info tick)
     351195816th Changed tick2024.06.21 08:38:43.695 Ask=0.93287 Bid=0.93287 (Info tick)
     351195817th Changed tick2024.06.21 08:38:52.203 Ask=0.93288 Bid=0.93288 (Info tick)
     351195818th Changed tick2024.06.21 08:38:55.105 Ask=0.93287 Bid=0.93287 (Info tick)
     351195819th Changed tick2024.06.21 08:38:57.607 Ask=0.93288 Bid=0.93288 (Info tick)
     351195820th Changed tick2024.06.21 08:39:00.512 Ask=0.93287 Bid=0.93287 (Info tick)
     351195821th Changed tick2024.06.21 08:39:03.113 Ask=0.93288 Bid=0.93288 (Info tick)
   */
  }
//+------------------------------------------------------------------+
//| Crea un símbolo personalizado, devuelve el código de error       |
//+------------------------------------------------------------------+
int CreateCustomSymbol(const string symbol_nameconst string symbol_pathconst string symbol_origin=NULL)
  {
//--- determinamos el nombre del símbolo a partir del cual se creará uno personalizado
   string origin=(symbol_origin==NULL ? Symbol() : symbol_origin);
   
//--- si no hemos podido crear el símbolo personalizado, y no se trata de un error 5304, informaremos sobre ello en el registro
   ResetLastError();
   int error=0;
   if(!CustomSymbolCreate(symbol_namesymbol_pathorigin))
     {
      error=GetLastError();
      if(error!=5304)
         PrintFormat("CustomSymbolCreate(%s, %s, %s) failed. Error %d"symbol_namesymbol_pathoriginerror);
     }
//--- con éxito
   return(error);
  }
//+------------------------------------------------------------------+
//| Elimina el símbolo personalizado                                |
//+------------------------------------------------------------------+
bool DeleteCustomSymbol(const string symbol_name)
  {
//--- ocultamos el símbolo de la ventana de Observación de mercado
   ResetLastError();
   if(!SymbolSelect(symbol_namefalse))
     {
      PrintFormat("SymbolSelect(%s, false) failed. Error %d"GetLastError());
      return(false);
     }
      
//--- si no se ha podido eliminar el símbolo personalizado, informaremos de ello en el registro y retornaremos false
   ResetLastError();
   if(!CustomSymbolDelete(symbol_name))
     {
      PrintFormat("CustomSymbolDelete(%s) failed. Error %d"symbol_nameGetLastError());
      return(false);
     }
//--- con éxito
   return(true);
  }
//+------------------------------------------------------------------+
//| Obtiene el número indicado de ticks en la matriz                  |
//+------------------------------------------------------------------+
bool GetTicksToArray(const string symbolconst uint countMqlTick &array[])
  {
//--- notificamos sobre el inicio de la carga de datos históricos
   PrintFormat("Requested %u ticks to get tick history for the symbol '%s'"countsymbol);
   
//--- haceremos tres intentos para obtener los ticks
   int attempts=0;
   while(attempts<3)
     {
      //--- medimos la hora de inicio antes de obtener los ticks
      uint start=GetTickCount();
      
      //--- solicitamos la historia de ticks desde el momento 1970.01.01 00:00.001 (parámetro from=1 ms)
      int received=CopyTicks(symbolarrayCOPY_TICKS_ALL1count);
      if(received!=-1)
        {
         //--- mostramos la información sobre el número de ticks y el tiempo invertido
         PrintFormat("The tick history for the '%s' symbol is received in the amount of %u ticks in %d ms"symbolreceivedGetTickCount()-start);
         
         //--- si la historia de ticks está sincronizada, el código de error será igual a cero, retornaremos true
         if(GetLastError()==0)
            return(true);
 
         PrintFormat("%s: Ticks are not synchronized yet, %d ticks received for %d ms. Error=%d"
                     symbolreceivedGetTickCount()-startGetLastError());
        }
      //--- calculamos los intentos 
      attempts++; 
      //--- pausa de 1 segundo a la espera de que finalice la sincronización de la base de ticks 
      Sleep(1000);
     }
//--- no ha sido posible copiar los ticks en 3 intentos
   return(false);
  }
//+------------------------------------------------------------------+ 
//| retorna la descripción de tipo string del tick                   |
//+------------------------------------------------------------------+ 
string GetTickDescription(MqlTick &tick
  { 
   string desc=StringFormat("%s.%03u "TimeToString(tick.timeTIME_DATE|TIME_MINUTES|TIME_SECONDS),tick.time_msc%1000);
   
//--- comprobamos las banderas de tick
   bool buy_tick   = ((tick.flags &TICK_FLAG_BUY)   == TICK_FLAG_BUY); 
   bool sell_tick  = ((tick.flags &TICK_FLAG_SELL)  == TICK_FLAG_SELL); 
   bool ask_tick   = ((tick.flags &TICK_FLAG_ASK)   == TICK_FLAG_ASK); 
   bool bid_tick   = ((tick.flags &TICK_FLAG_BID)   == TICK_FLAG_BID); 
   bool last_tick  = ((tick.flags &TICK_FLAG_LAST)  == TICK_FLAG_LAST); 
   bool volume_tick= ((tick.flags &TICK_FLAG_VOLUME)== TICK_FLAG_VOLUME); 
   
//--- comprobamos primero si hay banderas comerciales en el tick (para CustomTicksAdd() no las hay)
   if(buy_tick || sell_tick
     { 
      //--- formamos la salida para el tick comercial 
      desc += (buy_tick ? StringFormat("Buy Tick: Last=%G Volume=%d "tick.lasttick.volume)  : ""); 
      desc += (sell_tickStringFormat("Sell Tick: Last=%G Volume=%d ",tick.lasttick.volume) : ""); 
      desc += (ask_tick ? StringFormat("Ask=%G "tick.ask) : ""); 
      desc += (bid_tick ? StringFormat("Bid=%G "tick.ask) : ""); 
      desc += "(Trade tick)"
     } 
   else 
     { 
      //--- para la información del tick, formamos la salida un poco diferente 
      desc += (ask_tick   ? StringFormat("Ask=%G ",  tick.ask)    : ""); 
      desc += (bid_tick   ? StringFormat("Bid=%G ",  tick.ask)    : ""); 
      desc += (last_tick  ? StringFormat("Last=%G "tick.last)   : ""); 
      desc += (volume_tickStringFormat("Volume=%d ",tick.volume): ""); 
      desc += "(Info tick)"
     } 
//--- retornamos la descripción del tick
   return(desc); 
  } 

 

Vea también

CustomRatesDelete, CustomRatesUpdate, CustomTicksDelete, CopyTicks, CopyTicksRange