Runtime Errors - Codes of Errors and Warnings - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
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:
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:
Current Chart:
(datetime)ObjectGetInteger(0,Name,OBJPROP_TIME) = 2023.01.0200:00:00ObjectGetString(0,Name,OBJPROP_TOOLTIP) = This is a tooltip
New Chart:
(datetime)ObjectGetInteger(Chart,Name,OBJPROP_TIME) = 2023.01.0200:00:00ObjectGetString(Chart,Name,OBJPROP_TOOLTIP) =
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.
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(constint size=16)
{
ArrayResize(m_arr,size);
m_index=WRONG_VALUE;
}
bool Push(T const &item)
{
m_index++;
m_arr[m_index]=item;
returntrue;
}
};
MyStack<int> stki;
//+------------------------------------------------------------------+//| Script program start function |//+------------------------------------------------------------------+voidOnStart()
{
//---
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).
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.
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).
I found a spelling error, not sure, if this is considered a bug, but I would guess it exists already quite a while.
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
All is fixed.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:
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
Without restarting the terminal.
Without restarting the terminal.
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.
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).
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.
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:
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).