Discussão do artigo "MQL5 Cookbook: Implementando seu próprio Depth of Market (Book de Ofertas)" - página 5

 
Sim, uma versão diferente. Este artigo de 2015 contém o código do segundo artigo de acompanhamento de 2017 https://www.mql5.com/pt/articles/3336. Infelizmente, ele não está compilado. Para fins de treinamento, você pode usar a base de código original de 2015, na qual o vidro de preços funciona sem um gráfico. Publiquei o código acima. Quanto à nova versão, levará algum tempo para corrigi-la.
Пишем скальперский стакан цен на основе графической библиотеки CGraphic
Пишем скальперский стакан цен на основе графической библиотеки CGraphic
  • 2017.06.23
  • www.mql5.com
В статье создается базовый функционал скальперского стакана цен. Разрабатывается тиковый график на основе графической библиотеки CGraphic и интегрируется с таблицей заявок. С помощью описываемого стакана цен можно создать мощный помощник для краткосрочной торговли.
 
Vasiliy Sokolov #:
Infelizmente, ele não é compilado.

Há apenas alguns erros no código anexado a este artigo.

No arquivo MBookFon.mqh, a implementação do método não está definida corretamente - void está faltando:

void  CBookFon::Show(void)
{
   ObjectCreate(ChartID(), m_name, OBJ_RECTANGLE_LABEL, 0, 0, 0);
   ObjectSetInteger(ChartID(), m_name, OBJPROP_YDISTANCE, 13);
   ObjectSetInteger(ChartID(), m_name, OBJPROP_XDISTANCE, 6);
   ObjectSetInteger(ChartID(), m_name, OBJPROP_XSIZE, 116);
   ObjectSetInteger(ChartID(), m_name, OBJPROP_BORDER_TYPE, BORDER_FLAT);
   ObjectSetInteger(ChartID(), m_name, OBJPROP_BGCOLOR, clrWhite);
   int total = (int)m_book.InfoGetInteger(MBOOK_DEPTH_TOTAL);
   ObjectSetInteger(ChartID(), m_name, OBJPROP_YSIZE, total*15+16);
   CreateCeils();
   
   OnShow();
}


No arquivo MBookCeil.mqh, não há verificação do tamanho da matriz e do excesso de matriz:

void CBookCeil::Refresh(void)
{
   int total = (int)m_book.InfoGetInteger(MBOOK_DEPTH_TOTAL);
   if(total == 0 || m_index < 0 || m_index > total-1)
      return;
   ENUM_BOOK_TYPE type = m_book.MarketBook[m_index].type;
   long max_volume = 0;
   if(type == BOOK_TYPE_BUY || type == BOOK_TYPE_BUY_MARKET)
   {
      ObjectSetInteger(ChartID(), m_name, OBJPROP_BGCOLOR, clrCornflowerBlue);
      max_volume = m_book.InfoGetInteger(MBOOK_MAX_BID_VOLUME);
   }
   else if(type == BOOK_TYPE_SELL || type == BOOK_TYPE_SELL_MARKET)
   {
      ObjectSetInteger(ChartID(), m_name, OBJPROP_BGCOLOR, clrPink);
      max_volume = m_book.InfoGetInteger(MBOOK_MAX_ASK_VOLUME);
   }
   else
      ObjectSetInteger(ChartID(), m_name, OBJPROP_BGCOLOR, clrWhite);
   MqlBookInfo info = m_book.MarketBook[m_index];
   if(m_ceil_type == BOOK_PRICE)
      m_text.SetText(DoubleToString(info.price, Digits()));
   else if(m_ceil_type == BOOK_VOLUME)
      m_text.SetText((string)info.volume);
   if(m_ceil_type != BOOK_VOLUME)return;
   double delta = 1.0;
   if(max_volume > 0)
      delta = (info.volume/(double)max_volume);
   if(delta > 1.0)delta = 1.0;   
   long size = (long)(delta * 50.0);
   if(size == 0)size = 1;
   ObjectSetInteger(ChartID(), m_name, OBJPROP_XSIZE, size);
   ObjectSetInteger(ChartID(), m_name, OBJPROP_YDISTANCE, m_ydist);
}

Na primeira execução, quando o vidro de preço ainda não está conectado, o tamanho da matriz é zero e, portanto, o erro crítico é bloqueado.

 
Compilei os arquivos, mas ainda há erros. Alguém pode compartilhar uma versão funcional?
 
startatrix #:
Compilei os arquivos, mas os erros continuam. Alguém pode compartilhar uma versão funcional, por favor.
Se compilado, não há erros. Se houver falha na compilação, quais são os erros?