Errors, bugs, questions - page 3087

 
Aliaksandr Hryshyn #:

Please:

wnd - main window descriptor, find your own.

0x8134 - third parameter to clear logs from log tab

Checked it, it works.

Needed it, got it, thanks

#import "user32.dll"
long SendMessageW(long wnd, uint Msg, long param, ulong l = 0);
long GetAncestor(long hwnd, uint gaFlags);
#import
#define  GA_PARENT 1
#define  GA_ROOT 2
#define  GA_ROOTOWNER 3
//+------------------------------------------------------------------+
void OnStart()
{
   long handle = ChartGetInteger(0, CHART_WINDOW_HANDLE);
   if(handle != 0)
   {
      long h = GetAncestor(handle,GA_ROOTOWNER);
      SendMessageW(h, 0x111, 0x8135);
   }
}
 
Aliaksandr Hryshyn #:
Igor Makanu #:

Thank you! Too bad, it only works when the Log tab is active.

 
fxsaber #:

Thank you! Pity it only works when the Log tab is active.

That's what I wrote - find the right tab and give it focus and then just send the message.... it won't work in a couple lines of code

but for debugging,@Aliaksandr Hryshyn' s code works.

 
Igor Makanu #:

for debugging code@Aliaksandr Hryshyn works, seems convenient to me

Yes, thank you.

 
MQL_User #:

Hello all.

Can anyone tell me if there is any way to disable horizontal scrolling of the chart by moving the mouse cursor horizontally?

Yes, there is. So can the wheel.

It's all in the help. The main thing is to read it.

Документация по MQL5: Операции с графиками / ChartSetInteger
Документация по MQL5: Операции с графиками / ChartSetInteger
  • www.mql5.com
ChartSetInteger - Операции с графиками - Справочник MQL5 - Справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 
fxsaber #:

Thank you! Pity, it only works when the Log tab is active.

Might help (works in 4):

#define   GA_ROOT 2

// получаем системный дескриптор основного окна терминала
hMetaTrader = GetAncestor(WindowHandle(Symbol(), Period()), GA_ROOT);

// ищем окно "Терминал"
hControlBar = GetDlgItem(hMetaTrader, 0xE81E);
hControlBar = GetDlgItem(hControlBar, 0x0051);

// ищем список указанной вкладки (0 - эксперты, 1 - журнал)
hListView = GetDlgItem(hControlBar, (iTab == 0 ? 0x8A6A : 0x81B9));
 
Andrey Khatimlianskii #:

Might help (works in four):

Thanks, I'll have to look at the window codes in five.

 
Artyom Trishkin #:

You can. And with a wheel, too.

It's all in the help. The main thing is to read it.

Artem, thank you.

I was looking in the program settings to disable this option and somehow didn't think it could be done from the code.

 

Hello!

A search of the forum yielded several answers, but in this case, none was the solution. Therefore, I will ask a similar question again, maybe this time it will be heard.

I have a terminal MT5 build 3036, which is the "newest".

I create a custom indicator in the editor using the wizard and compile it blank (to avoid all possible errors in the code).

//+------------------------------------------------------------------+
//|                                              CustomIndicator.mq5 |
//|                                  Copyright 2021, MetaQuotes Ltd. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2021, MetaQuotes Ltd."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property indicator_chart_window
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const int begin,
                const double &price[])
  {
   return(rates_total);
  }
//+------------------------------------------------------------------+

Then I attach the compiled indicator to the chart and perform the switching of timeframes and at every switch the record appears in the log that the indicator has been moved to a new timeframe and deleted from the previous one. This happens every time the periods are switched.

MG      0       15:37:11.020    Indicators      custom indicator CustomIndicator (GBPUSD,M5) loaded succesfully
ML      0       15:37:27.861    Indicators      custom indicator CustomIndicator (GBPUSD,M1) loaded succesfully
DP      0       15:37:30.884    Indicators      custom indicator CustomIndicator (GBPUSD,M3) loaded succesfully
EG      0       15:37:32.004    Indicators      custom indicator CustomIndicator (GBPUSD,M1) removed
OI      0       15:37:32.004    Indicators      custom indicator CustomIndicator (GBPUSD,M5) removed
EO      0       15:37:33.974    Indicators      custom indicator CustomIndicator (GBPUSD,M5) loaded succesfully
KG      0       15:37:37.010    Indicators      custom indicator CustomIndicator (GBPUSD,M3) removed
JJ      0       15:37:37.048    Indicators      custom indicator CustomIndicator (GBPUSD,M15) loaded succesfully
HN      0       15:37:42.004    Indicators      custom indicator CustomIndicator (GBPUSD,M5) removed
CP      0       15:37:48.800    Indicators      custom indicator CustomIndicator (GBPUSD,M30) loaded succesfully
IG      0       15:37:52.003    Indicators      custom indicator CustomIndicator (GBPUSD,M15) removed


If you use a ready-made indicator from the "standard set", this does not happen. This happens only with indicators compiled from the "fresh" build.


The question - what is the error?

 

Hello again!

Does anyone know how to place on the Market an Expert consisting of several files - the Expert itself and a couple of Indicators, which are loaded through #resource?

Reason: