Exportação do Times and Sales

Para adicionar comentários, por favor Faça o login ou registrar
Renato Castro
43
Renato Castro  



//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
enum  ENUM_COPY_TICKS
  {
   TICKS_INFO=1,     // only/Bid è Ask 
   TICKS_TRADE=2,    // only/Last è Volume
   TICKS_ALL=-1,     // all ticks
  };
//--- input parameters
input int               ticks=1;       // number of requested tics
//--- parameters
input ENUM_COPY_TICKS   type=COPY_TICKS_TRADE;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   Print(TICK_FLAG_BID," - tick has changed a Bid price");
   Print(TICK_FLAG_ASK,"  - a tick has changed an Ask price");
   Print(TICK_FLAG_LAST," - a tick has changed the last deal price");
   Print(TICK_FLAG_VOLUME," - a tick has changed a volume");
   Print(TICK_FLAG_BUY," - a tick is a result of a buy deal");
   Print(TICK_FLAG_SELL," - a tick is a result of a sell deal");
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const int begin,
                const double &price[])
  {
//--- the array that receives ticks
   MqlTick tick_array[];
    MqlTick t;
//--- requesting ticks
   int copied=CopyTicks(_Symbol,tick_array,type,0,ticks);
//--- if ticks are received, show the Bid and Ask values on the chart

      //--- generate the comment contents 
      /*
      string flags="";
         
         if((tick_array[0].flags  &TICK_FLAG_BID)==TICK_FLAG_BID)
            flags=" TICK_FLAG_BID "+id;
         if((tick_array[0].flags  &TICK_FLAG_ASK)==TICK_FLAG_ASK)
            flags+=" TICK_FLAG_ASK "+id;
         if((tick_array[0].flags  &TICK_FLAG_LAST)==TICK_FLAG_LAST)
            flags+=" TICK_FLAG_LAST "+id;
         if((tick_array[0].flags  &TICK_FLAG_VOLUME)==TICK_FLAG_VOLUME)
            flags+=" TICK_FLAG_VOLUME "+id;
         if((tick_array[0].flags  &TICK_FLAG_BUY)==TICK_FLAG_BUY)
            flags+=" TICK_FLAG_BUY "+id;
         if((tick_array[0].flags  &TICK_FLAG_SELL)==TICK_FLAG_SELL)
            flags+=" TICK_FLAG_SELL "+id;
*/       
        if(copied>0){
        Print(tick_array[0].volume);
        }
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+
//| Indicator  deinitialization function                             |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//--- 
   Comment("");
  }
//+------------------------------------------------------------------+
Olá,
Meu objetivo é exportar cada ordem executada no mercado, mas primeiro, preciso resolver este problema.
Não consigo plotar no console ou exportar sem que ocorra uma repetição das ordens executadas.
Alguém já passou por isso?



Para adicionar comentários, por favor Faça o login ou registrar