Times and Sales - página 2

 
Evandro Teixeira:

Olá Rogério,

segue em anexo a versão final da ferramenta.

Uma dúvida em relação à esta imagem que você postou. Qual versão você está usando do MT5? Esse simbolo entre os botões 'Show Tick Chart' e 'Show Extended Book' é o histórico de negócios? Tem como ativar ele na versão 1340?

 

Abraços!

Caro Evandro... sou marinheiro de primeira viagem. A ferramenta q vc postou no anexo já é funcional? Tentei instalar aqui, mas qdo mando compilar apresenta erros... Tá certo o q fiz?

Desde já, parabéns pela iniciativa e eu considero uma ferramenta muito útil!

Abç. 

 
oldsmob:

Caro Evandro... sou marinheiro de primeira viagem. A ferramenta q vc postou no anexo já é funcional? Tentei instalar aqui, mas qdo mando compilar apresenta erros... Tá certo o q fiz?

Desde já, parabéns pela iniciativa e eu considero uma ferramenta muito útil!

Abç. 

Sim, já é funcional mas você precisa se certificar de ter no diretório include a classe CComment.

https://www.mql5.com/pt/code/13688

 

Abraço! 

CComment Class
CComment Class
  • votos: 23
  • 2015.11.06
  • Andrey Voytenko
  • www.mql5.com
Classe para a exibição de comentários multilinhas.
 
Charles Almeida:

Boa tarde Rogerio,

 Onde acho essa build? 

Olá Charles,

basta se conectar ao servidor da MetaQuotes que automaticamente será baixado essa versão: access.metatrader5.com:443

 

Abraço 

 
Charles Almeida:

Boa tarde Rogerio,

 Onde acho essa build? 

Olá Charles,

Estou vendo um grande esforço da MetaQuotes em termos de tecnologia para melhorar os dados de profundidade de mercado e fluxo de ordens.

Melhores cumprimentos,

Rogério Figurelli 

 
Evandro Teixeira:

Sim, já é funcional mas você precisa se certificar de ter no diretório include a classe CComment.

https://www.mql5.com/pt/code/13688

 

Abraço! 

Funcionou perfeito!! Só alterei o ativo (DOLQ16)!!! Maravilha! Vou estudar isso aqui!

Muito obrigado. 

 
Evandro Teixeira:

Olá Rogério,

segue em anexo a versão final da ferramenta.

Uma dúvida em relação à esta imagem que você postou. Qual versão você está usando do MT5? Esse simbolo entre os botões 'Show Tick Chart' e 'Show Extended Book' é o histórico de negócios? Tem como ativar ele na versão 1340?

 

Abraços!

Boa Tarde Evandro

    Estou com erro no :  #include <comment.mqh>     ,    pode me dizer onde encontro ?

 
Pedro Quina:

Boa Tarde Evandro

    Estou com erro no :  #include <comment.mqh>     ,    pode me dizer onde encontro ?

Olá Pedro.

É só baixar o arquivo comment.mqh e salvar na pasta \MQL5\Include\

https://www.mql5.com/pt/code/13688

Abraço! 

CComment Class
CComment Class
  • votos: 24
  • 2015.11.06
  • //www.mql5.com/pt/users/avoitenko">
  • www.mql5.com
Classe para a exibição de comentários multilinhas.
 

Bom dia Evandro

 

      Tomei a liberdade de implementar 1 item no seu código :

 

1o) Permitir FILTRAR volumes não desejados. Por exemplo, caso não queira visualizar volumes menores que 5, basta incluir 5 como valor do filtro.

Arquivos anexados:
TimeNSales.mq5  16 kb
 

ótimo indicador ! 

com qual código por ex eu posso desenhar um ponto no gráfíco ?

para ir guardando quais foram as maiores agressões ?

 

parabéns pelo indicador novamente ! 

 
livetraderbr:

ótimo indicador ! 

com qual código por ex eu posso desenhar um ponto no gráfíco ?

para ir guardando quais foram as maiores agressões ?

 

parabéns pelo indicador novamente ! 

Olá livetraderbr, no exemplo abaixo o indicador desenha na tela uma linha quando a agressão for maior que 20 lotes. Testei apenas no mini índice buscado os lotes do contrato padrão no gráfico de 1 min. Em outros ativos ou tempo maior provavelmente não vai funcionar.

Abraço. 

//+------------------------------------------------------------------+
//|                                           TimesAndSalesChart.mqh |
//|                               Copyright © 2016, Evandro Teixeira |
//|                                   http://www.evandroteixeira.com |
//+------------------------------------------------------------------+
#property copyright                 "Evandro Teixeira © 2016"
#property link                      "www.evandroteixeira.com"
#property version                   "1.20"
#property description               "Times and Sales Chart"
#property indicator_plots 0
#property indicator_chart_window

//+------------------------------------------------------------------+
//| Global parameters                                                |
//+------------------------------------------------------------------+
enum _enumAlert
{
   _alarmYes      = 1,     // On
   _alarmNo       = 2     // Off
};

input _enumAlert                 _onOffAlert          = _alarmYes;                  // Alarm
input string                     _INPativo            = "INDZ16";                  // Symbol
input double                     _INPvolume           = 20;                       // Volume
input double                     _INPalert            = 25;                      // Volume Alert
//clrMidnightBlue BG

string      symbNAME    = _INPativo;

string nameRS    = "TNS Chart | ";

//+------------------------------------------------------------------+
//| On Init                                                          |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
      StringTrimRight(symbNAME);
      StringTrimLeft(symbNAME);
      //--- se resulta em comprimento zero da string do 'symbNAME'
      if(StringLen(symbNAME)==0)
         symbNAME = _Symbol;

      SymbolSelect(_INPativo,true);

//--- Define frequência do timer
   EventSetTimer(1);
   return(0);
  }

//+------------------------------------------------------------------+
//| On DeInit                                                        |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//--- Destroy panel
      ObjectsDeleteAll(0,nameRS,0,OBJ_TREND);
      ObjectsDeleteAll(0,"TNS Chart | ",0,OBJ_TREND);
      ObjectsDeleteAll(0,0,OBJ_TREND);
  }
//+------------------------------------------------------------------+
//| On Calculate                                                     |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
//--- requesting ticks
   MqlTick tick_array[];
   datetime timeCand[];

   int copied        =  CopyTicks(symbNAME,tick_array,COPY_TICKS_TRADE);

   ArraySetAsSeries(tick_array,false);

//---
   if(copied>0)
     {
         for(int i=0;i<copied;i++)
            {
               bool playSound = i == 0;

               MqlTick tick      = tick_array[i];
               bool buy          = tick.flags   == 56 && tick.last >= tick.ask;                                   //24
               bool sell         = tick.flags   == 88 && tick.last <= tick.bid;                                  //24
               bool between      = tick.flags   == 120 && tick.last < tick.ask && tick.last > tick.bid;         //24
               bool auction      = tick.bid > tick.ask; //&& tick.last > tick.ask;

               ArraySetAsSeries(close,true);
               ArraySetAsSeries(open,true);
               ArraySetAsSeries(time,true);

               if(buy && tick.volume >=_INPvolume)
                  {                    
                     datetime end   = tick.time+(datetime)tick.volume*PeriodSeconds(PERIOD_CURRENT);
                    
                     ObjectDelete      (0,nameRS+IntegerToString(i));
                     if(!ObjectCreate  (0,nameRS+IntegerToString(i),OBJ_TREND,0,(datetime)TimeToString(tick.time,TIME_DATE|TIME_MINUTES),tick.last,end,tick.last,0,0))
                        {
                           Print(__FUNCTION__,": failed to draw trend line! Error code: ",GetLastError());
                        }
                     ObjectSetInteger  (0,nameRS+IntegerToString(i),OBJPROP_WIDTH, 1);
                     ObjectSetInteger  (0,nameRS+IntegerToString(i),OBJPROP_COLOR, clrCornflowerBlue);

                     ObjectSetInteger  (0,nameRS+IntegerToString(i),OBJPROP_STYLE,STYLE_SOLID);
                     ObjectSetInteger  (0,nameRS+IntegerToString(i),OBJPROP_SELECTABLE,false);
                     ObjectSetInteger  (0,nameRS+IntegerToString(i),OBJPROP_SELECTED,false);
                     ObjectSetInteger  (0,nameRS+IntegerToString(i),OBJPROP_BACK,true);
                     ObjectSetString   (0,nameRS+IntegerToString(i),OBJPROP_TOOLTIP,DoubleToString(tick.last,Digits())+" | "+DoubleToString(tick.volume,0)+" | BUYER");
                  }
               else if(sell && tick.volume>=_INPvolume)
                     {                        
                        datetime end   = tick.time+(datetime)tick.volume*PeriodSeconds(PERIOD_CURRENT);
                        
                        ObjectDelete      (0,nameRS+IntegerToString(i));
                        if(!ObjectCreate  (0,nameRS+IntegerToString(i),OBJ_TREND,0,(datetime)TimeToString(tick.time,TIME_DATE|TIME_MINUTES),tick.last,(datetime)TimeToString(end,TIME_DATE|TIME_MINUTES),tick.last,0,0))
                           {
                              Print(__FUNCTION__,": failed to draw trend line! Error code: ",GetLastError());
                           }
                        ObjectSetInteger  (0,nameRS+IntegerToString(i),OBJPROP_WIDTH, 1);
                        ObjectSetInteger  (0,nameRS+IntegerToString(i),OBJPROP_COLOR, clrCoral);
  
                        ObjectSetInteger  (0,nameRS+IntegerToString(i),OBJPROP_STYLE,STYLE_SOLID);
                        ObjectSetInteger  (0,nameRS+IntegerToString(i),OBJPROP_SELECTABLE,false);
                        ObjectSetInteger  (0,nameRS+IntegerToString(i),OBJPROP_SELECTED,false);
                        ObjectSetInteger  (0,nameRS+IntegerToString(i),OBJPROP_BACK,true);
                        ObjectSetString   (0,nameRS+IntegerToString(i),OBJPROP_TOOLTIP,DoubleToString(tick.last,Digits())+" | "+DoubleToString(tick.volume,0)+" | SELLER");
                     }
                     else if(between && tick.volume >=35)
                              {                    
                                 datetime end   = tick.time+(datetime)tick.volume*PeriodSeconds(PERIOD_CURRENT);

                                 ObjectDelete      (0,nameRS+IntegerToString(i));
                                 if(!ObjectCreate  (0,nameRS+IntegerToString(i),OBJ_TREND,0,(datetime)TimeToString(tick.time,TIME_DATE|TIME_MINUTES),tick.last,(datetime)TimeToString(end,TIME_DATE|TIME_MINUTES),tick.last,0,0))
                                    {
                                       Print(__FUNCTION__,": failed to draw trend line! Error code: ",GetLastError());
                                    }
                                 ObjectSetInteger  (0,nameRS+IntegerToString(i),OBJPROP_WIDTH, 1);
                                 ObjectSetInteger  (0,nameRS+IntegerToString(i),OBJPROP_COLOR, clrForestGreen);
            
                                 ObjectSetInteger  (0,nameRS+IntegerToString(i),OBJPROP_STYLE,STYLE_SOLID);
                                 ObjectSetInteger  (0,nameRS+IntegerToString(i),OBJPROP_SELECTABLE,false);
                                 ObjectSetInteger  (0,nameRS+IntegerToString(i),OBJPROP_SELECTED,false);
                                 ObjectSetInteger  (0,nameRS+IntegerToString(i),OBJPROP_BACK,true);
                                 ObjectSetString   (0,nameRS+IntegerToString(i),OBJPROP_TOOLTIP,DoubleToString(tick.last,Digits())+" | "+DoubleToString(tick.volume,0)+" | SPREAD");
                              }
               if(tick.volume >= _INPalert)
                  soundVolume(playSound);
            }
            ZeroMemory(tick_array);
     }
   else
     {
          Print("Ticks could not be loaded. GetLastError()=",GetLastError());
     }

//---
      return(rates_total);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void soundVolume(bool psDT)
   {
      if(_onOffAlert == 1 && psDT)
         PlaySound("tick.wav");
   }
Razão: