Times and Sales - página 3

 
Evandro Teixeira:

Olá livetraderbr, no exemplo abaixo o indicador desenhar 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");
   }
poxa.. muito obrigado pela ajuda !
 

ola amigos,

 

so roda pela xp ne ?

 
ROVIGUA:

ola amigos,

 

so roda pela xp ne ?

Olá Rovigua, esse indicador roda em qualquer corretora.

 

Abraço.

 
Olá!!! Desculpe a ignorancia. Este arquivo é mqh, e ele vai para a pasta "include". Como faço para usufruir ele no mt5?
 
Rui Romão:
Olá!!! Desculpe a ignorancia. Este arquivo é mqh, e ele vai para a pasta "include". Como faço para usufruir ele no mt5?

Olá Rui,

você pode salvar o arquivo na pasta 'Experts' e depois compila-lo no MetaEditor e então ele estará pronto para ser usado.

Abraço. 

 
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!


Alguém esta com a versão nova, quero começar a estudar este trabalho

 

Pessoal

Alguém conhece alguma ferramenta para MT5 que possibilite dividir o Times and Sales do MT5 em somente COMPRA e VENDA?

Obrigado

Marco.

 
Marco Nepomuceno:

Pessoal

Alguém conhece alguma ferramenta para MT5 que possibilite dividir o Times and Sales do MT5 em somente COMPRA e VENDA?

Obrigado

Marco.


Não entendi, vc quer ver apenas COMPRA ou apenas VENDA?

 
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!


Evandro Estou tentando usar essa seu código no MT5 mais ele não coloca colar nem plota o nome sell e buy sei que o novo mt5 ja tem essa funcionalidade mais gostei mais do seu poderia me ajudar dizendo o que devo fazer no código acredito que na nova versão alguma coisa mudou não sei ele compila perfeitamente!!

 
Japa Trader Br:

Não entendi, vc quer ver apenas COMPRA ou apenas VENDA?

sim dividir em grupo os de preço por exemplo com cor diferente quando estiver no mesmo preço estou tentando tbm mais não conseguir 

input bool                       _INPPriceGroup       = false;       // Price Group

o indicador que vc modificou esta funcionando perfeitamente na nova versão poderia compartilhar o codigo?

Razão: