Errors, bugs, questions - page 2391

 
Kisolen:
When entering standby on Windows 10 (I don't remember which one, but it is modern and interprise ltsb 1607 (pretty old)) on MT5, EA stops being attached to chart, trades stop being executed, but some functions (output of graphic self written window, which is functional) stay active. Is this a bug of MT or a problem with the EA? Thank you.

Standby mode is when the computer is practically switched off. All programs are stopped.

 
Thank you for your response to the last comment. There is one more question. MT5. I make an interface template , without "grid" on the chart, I call this template "Default" so it is enabled by default, everything works in MT itself, but it does not work in the EA visualization window. Thank you.
 
Kisolen:
Thank you for your reply to the previous comment. There is one more question. MT5. I am making an interface template , without the "grid" on the chart, I call this template "Default" so it is enabled by default, in the MT itself everything works, but it does not work in the EA visualization window. Thank you.

The "default.tpl" chart template applies when you open a new chart in the terminal, while the "tester.tpl" chart template applies when you run a strategy tester in visual mode.

Click here for more information: Templates and Profiles - Advanced Features - Quotes, Technical and Fundamental Analysis charts

 

Hi all.

I would like to draw developers' attention to the following bug in MT5 (build 2006). When calling theChartGetInteger function with property identifiersCHART_WIDTH_IN_BARS orCHART_VISIBLE_BARS, if another window is active with the same symbol but a smaller TF, the function returns incorrect values. If the chart has the maximum scaling (5), the returned value is less than the real value by 5. If the scaling is 4, the returned value is smaller by 10. If scaling is 3, then respectively by 20, etc. The code for the test indicator, to reproduce the glitch is below. This glitch is stably reproduced on TF D1 and the RTS-3.19 instrument. I have also recorded a video with bug demonstration for clarity. In build 274(judging by history) similar bug had been already fixed, but apparently not to the end. :)

//+------------------------------------------------------------------+
//|                                                     DBS_Bug2.mq5 |
//|                                            Copyright © 2019, DBS |
//+------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_buffers 1                                         //количество индикаторных буферов
#property indicator_plots   1                                         //количество графических построений
//+------------------------------------------------------------------+ 
//| Функция инициализации индикатора                                 | 
//+------------------------------------------------------------------+
int OnInit()
  {
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+ 
//| Функция расчёта индикатора                                       | 
//+------------------------------------------------------------------+
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[])
  {
//---Debug
   int chart_bars=int(ChartGetInteger(0,CHART_WIDTH_IN_BARS));     //к-во баров на экране
   int vis_bars=int(ChartGetInteger(0,CHART_VISIBLE_BARS));        //к-во баров видимых на экране
   PrintFormat("%s: Debug #2! rates_total=%i chart_bars=%i vis_bars=%i",__FUNCTION__,rates_total,chart_bars,vis_bars);
   return(rates_total);
  }
//+------------------------------------------------------------------+

I used to get even a funnier return value of this function (especially when loading the terminal). At maximum chart scale (5) the return value =5 (regardless of the actual number of bars on the chart). If the zoom is 4, then return value =10. If scaling is 3, then respectively =20, etc. Unfortunately, I didn't manage to capture this glitch on video. However, I killed the whole day to understand why my indicator works incorrectly on D1, while it is OK on other TFs.


P.S. Log from the same chart (RTS-3.19, D1) after a couple of hours (after break in connection). Realistically 55 bars are shown on the chart. And MT5 in the log says, that only 5 fit on the screen, and there are no visible bars at all:)Screenshot

2019.02.24 21:27:09.692 DBS_Volume (RTS-3.19,D1)        DBS Volume (VOLUME_REAL): SetVolScale: Debug #1!  max_vol_idx=3 max_vol=402550 time=2019.02.19 00:00 rates_total=220 chart_bars=5 vis_bars=0
MetaTrader 5 Client Terminal build 274
MetaTrader 5 Client Terminal build 274
  • 2010.05.15
  • MetaQuotes Software Corp.
  • www.metatrader5.com
Terminal: Исправлено отображение истории торговли на чарте. Terminal: Исправлена ошибка в навигации чарта (при отключеном сдвиге и автоскроле). Terminal: Исправления по сообщениям на форуме и крешлогам. Terminal: В файл помощи добавлено описание Тестера Стратегий MetaTester: Исправлена ошибка в загрузке параметров тестирования при смене...
 
Dmitriy Burlachenko:

Developers hello.

The MQL5 Standard Library Help has the WindowHandle function, but when using it, the compiler says 'WindowHandle' - function not defined'. Question: Who is glitching the code or the compiler? :)

It's SB.

int CChart::WindowHandle(void) const;
 
Dmitriy Burlachenko:

Developers hello.

The MQL5 Standard Library Help has the WindowHandle function, but when using it, the compiler says 'WindowHandle' - function not defined'. Question: Who is glitching the code or the compiler? :)


You are using Help incorrectly.

Look carefully:MQL5 ReferenceStandard LibraryPrice ChartsWindowHandle

Go back a step and read thePrice Charts section


Added:

Example use case (note - you need to execute theAttach method first) and only then work with the object

//+------------------------------------------------------------------+
//|                       Gets window handle of the chart (HWND).mq5 |
//|                              Copyright © 2019, Vladimir Karputov |
//|                                           http://wmua.ru/slesar/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2019, Vladimir Karputov"
#property link      "http://wmua.ru/slesar/"
#property version   "1.00"
#property description "Gets window handle of the chart (HWND)"
//---
#include <Charts\Chart.mqh>
CChart   m_chart;                      // CChart object
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {

   m_chart.Attach(); // assigns the current chart to the class instance

   Print("CChart.WindowHandle: ",m_chart.WindowHandle());
   Print("CChart.ChartId: ",m_chart.ChartId());
  }
//+------------------------------------------------------------------+

Result:

2019.02.25 16:01:32.165 Gets window handle of the chart (HWND) (GBPUSD,H1)      CChart.WindowHandle: 13830128
2019.02.25 16:01:32.165 Gets window handle of the chart (HWND) (GBPUSD,H1)      CChart.ChartId: 131571247244850547
 
Dmitriy Burlachenko:

Developers hello.

The MQL5 Standard Library Help has theWindowHandle function, but when using it, the compiler says 'WindowHandle' - function not defined'. Question: Who is glitching the code or the compiler? :)

use:

ChartGetInteger(0,CHART_WINDOW_HANDLE,0);
 
Vladimir Karputov:

You are using the wrong help.

Look carefully:MQL5 ReferenceStandard LibraryPrice ChartsWindowHandle

Go back a step and readPrice Charts


Added:

Example use case (note - you need to execute theAttach method first) and only then work with the object

Result:

Thank you.

 
Ошибки, баги, вопросы
Ошибки, баги, вопросы
  • 2019.02.21
  • www.mql5.com
Общее обсуждение: Ошибки, баги, вопросы
 

MQL5 ME 2006

#property strict

class A
 { 
public:
  int f();
 };

void OnStart()
  {
   A a;
   a.f();
  }

Same code in MQL4 as it should be,"function 'f' must have a body"