MT5/mql5 reported and confirmed bugs. - page 10

 

I found a spelling error, not sure, if this is considered a bug, but I would guess it exists already quite a while.



if(GetLastError() == ERR_RESOURCE_UNSUPPOTED_TYPE)
{
        printf("%s", "Unsupported resource type");
}


The constant "ERR_RESOURCE_UNSUPPOTED_TYPE" sould be spelled ERR_RESOURCE_UNSUPPORTED_TYPE.


Nether the less, there are quie some constants which are not declared/defined, but documented...

List of not defined/declared constants, but documented in docs here:

https://www.mql5.com/en/docs/constants/errorswarnings/errorcodes


ERR_FTP_CLOSED
ERR_DATABASE_INTERNAL_DB
ERR_DATABASE_INTERRUPT
ERR_DATABASE_NOTFOUND
ERR_DATABASE_EMPTY
ERR_DATABASE_NOLFS
ERR_DATABASE_FORMAT
TRADE_RETCODE_FIFO_ONLY
All is fixed.
Documentation on MQL5: Constants, Enumerations and Structures / Codes of Errors and Warnings / Runtime Errors
Documentation on MQL5: Constants, Enumerations and Structures / Codes of Errors and Warnings / Runtime Errors
  • www.mql5.com
Runtime Errors - Codes of Errors and Warnings - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 

Forum on trading, automated trading systems and testing trading strategies

Tooltips disappear when terminal restarts !!

Fernando Carreiro, 2022.06.05 16:02

I decided to test it myself and can confirm that on MetaTrader 5 build 3320, the tooltip text is not saved in the ".chr" files, meaning that on a restart the tooltip text is lost.

I use the following test Script to the test the issue:

void OnStart()
{
   string sName = "TestTooltip" + (string) TimeCurrent();
   ObjectCreate( 0, sName, OBJ_ARROW_CHECK, 0, 
      iTime( _Symbol, _Period, 0 ), iClose( _Symbol, _Period, 0 ) );
   ObjectSetInteger( 0, sName, OBJPROP_HIDDEN, false );
   ObjectSetString( 0, sName, OBJPROP_TOOLTIP, "This is a tooltip" );
};

I also decided to test this on MetaTrader 4 build 1356, and the results were similar — the tooltip text is not saved in the ".chr" files.

My conclusion, is that this is in fact a bug that has existed for a very long time, given that after searching the forum, I found that this has been seen before:


Forum on trading, automated trading systems and testing trading strategies

[bug?] Tooltip values lost on restart of Terminal

stamat, 2012.07.05 19:56

I experience the following behavior in MT5:

1. When an object is created it receives automatically set Name and Tooltip values. 

2. After an object Tooltip value is changed via ObjectSetString(), the Tooltip value it remains the changed until MT5 Terminal is restarted.

3. On Terminal restart, the object's Tooltip value is for some reason automatically reverted to whatever is the object Name.

 

Why is there no consistency of tooltip values in between MT5 sessions?

Forum on trading, automated trading systems and testing trading strategies

After restart MT5 deletes object tooltip [MetaTrader 5 Bug]

Jürgen Rothstein, 2020.01.28 11:56

Dear MQL5 Community/Administrators/Developers,

There is a bug on MT5 when assigning a tooltip to a graphical object, it gets deleted after restarting the terminal.

It can be reproduced by following the below described steps:

  1. Create a graphical object (OBJ_LABEL, OBJ_ARROW, OBJ_TREND, etc...) using ObjectCreate or using the ChartObjectsTxtControls.mqh library
  2. Assign a tooltip to it using ObjectSetString (OBJPROP_TOOLTIP)
  3. Hover your mouse on the created object in order to display the tooltip
  4. Restart the MT5 terminal
  5. Hover your move on the object once again

The terminal will not display the tooltip that has been set earlier.

I hope there will be a fix soon.

Thanks
Kind Regards
 
Fernando Carreiro #:

Without restarting the terminal.

#define PRINT(A) Print(#A + " = " + (string)(A))
 
void OnStart()
{
  const string Name = "Name";
  
  ObjectCreate(0, Name, OBJ_VLINE, 0, D'2023.01.02', 0);
  ObjectSetString (0, Name, OBJPROP_TOOLTIP, "This is a tooltip");
  
  Print("\nCurrent Chart:");
  PRINT((datetime)ObjectGetInteger(0, Name, OBJPROP_TIME));
  PRINT(ObjectGetString(0, Name, OBJPROP_TOOLTIP));
  
  const ulong Chart = ChartOpen(_Symbol, _Period);
  const string FileName = "\\Files\\FileName.tpl";
  
  if (ChartSaveTemplate(0, FileName) && ChartApplyTemplate(Chart, FileName))
  {    
    ChartGetInteger(Chart, CHART_WINDOW_HANDLE);
    
    Print("\nNew Chart:");
    PRINT((datetime)ObjectGetInteger(Chart, Name, OBJPROP_TIME));
    PRINT(ObjectGetString(Chart, Name, OBJPROP_TOOLTIP));
  }
}


Current Chart:
(datetime)ObjectGetInteger(0,Name,OBJPROP_TIME) = 2023.01.02 00:00:00
ObjectGetString(0,Name,OBJPROP_TOOLTIP) = This is a tooltip

New Chart:
(datetime)ObjectGetInteger(Chart,Name,OBJPROP_TIME) = 2023.01.02 00:00:00
ObjectGetString(Chart,Name,OBJPROP_TOOLTIP) = 
 
Fernando Carreiro #:
fxsaber #:

Without restarting the terminal.


Reported to MQ.
 
Fernando Carreiro #:
fxsaber #:

Without restarting the terminal.


Metaquotes developer answer :

It is not a bug, just platform limit
MT5/4 does not save tooltips for objects, because tooltip can be added/modified by MQL programs only - it is official answer.

We will check if it's possible to add this feature - Not a priority.

 
Alain Verleyen #: Metaquotes developer answer :
Translation ... "no, he is not dead, he just reached his life limit". 🤦‍♂️
 

The generic libraries don't allow to cover all situations (primitive,structs,objects) in one template class.

I think the reason is this:

template<typename T>
class MyStack
  {
private:
   T                 m_arr[];
   int               m_index;
public:
   void              MyStack(const int size=16)
     {
      ArrayResize(m_arr,size);
      m_index=WRONG_VALUE;
     }
   bool              Push(T const &item)
     {
      m_index++;
      m_arr[m_index]=item;
      return true;
     }
  };
MyStack<int> stki;
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {

//---
   stki.Push(5);
  }

The compile says:

Because the variable is declared by reference, there's a possibility that the Push method will change it's value, which should reflect in the caller side and for this reason it does not allow to pass '5' by reference. But as you can see I added 'const' to the parameter definition in the Push method, which takes the sting out of the reason to not allow that (in C++ it's allowed).

 
Amir Yacoby #:

The generic libraries don't allow to cover all situations (primitive,structs,objects) in one template class.

I think the reason is this:

The compile says:

Because the variable is declared by reference, there's a possibility that the Push method will change it's value, which should reflect in the caller side and for this reason it does not allow to pass '5' by reference. But as you can see I added 'const' to the parameter definition in the Push method, which takes the sting out of the reason to not allow that (in C++ it's allowed).

That's not really a bug but an mql limitation.

Anyway, I do agree with you it would be good to be able to create really generic code.

Unfortunately, this is far from the only problem in doing so.

 
Alain Verleyen #:

That's not really a bug but an mql limitation.

Anyway, I do agree with you it would be good to be able to create really generic code.

Unfortunately, this is far from the only problem in doing so.

A template parameter <typename T> can be passed to one of two types of methods:

  • By value to a method that accepts object pointers or primitives(including literals): void Func(T parm) but not structs (this path was chosen by the MQL5 generic library as it is today)  
  • By reference to a method that accepts objects/structs/primitive(variables but not literals): void Func(const T &parm) - this option in c++ from where all the rest of MQL5 including templates came from, is allowed to accept primitive literals as well.
So at least let it be known that this is the reason that generic templates are not really generic because they took it from c++ but limited it, knowingly or unknowingly(most probably the latter).
 
Alain Verleyen #:

That's not really a bug but an mql limitation.

Anyway, I do agree with you it would be good to be able to create really generic code.

Another related is passing an anonymous temporary (return from a function) passed to another by reference (constant or not).

Reason: