Hi Fellow Traders and coders.
I have some interesting problem giving me some hard time to resolve several days.
Recently I played with OBJ_LABEL on both MT5 and MT4. The code is shown below. The aim of this code is to write some text on indicator sub window (separate window from main window).
The funny things is this code works perfectly on Meta Trader 5 platform. Also it works well on Meta Trader 4 platform most of time.
However the problem is that I don't see the text any more when I restart Meta Trader 4 terminal (restarted after the indicator is attached on charts).
This does not happen on Meta Trader 5 terminal though.
The few clues I have found so far is:
- While Meta Trader 4 is on and when I switch between different time frame, the text is shown as it should be. So ok.
- When I apply the same code to write something on Main window, it works fine. Even I restart Meta trader 4 terminal, they works as it should be.
- The code block works perfectly on Meta Trader 5 terminal. So no issue with restarting Meta Trader 5 terminals.
Let me know if this couple of clues giving your some idea. So far, I don't find any logical ways of explaining this issue. Or this should be considered as bugs ?
I will really appreciate your brilliant wisdom.
Kind regards.
F.E.
It is outside OnInit or OnCalculate. It is rather a function and called when it is necessary.
Regards.
So when ?
So when ?
The function will be called at least once by OnCalculate each new bar.
It will be also called by ChartEvent Handler frequently.
However when I check objects from terminal. The terminal have all the labels. It seems the terminal just mixing up its display order between the background label and text label. I have not got any clue why this is happening and what is fix.
ObjectCreate (0, "back", OBJ_LABEL, subWindow, 0, 0); //background label. ObjectCreate (0, "label", OBJ_LABEL, subWindow, 0, 0); //text label
Regards.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi Fellow Traders and coders.
I have some interesting problem giving me some hard time to resolve several days.
Recently I played with OBJ_LABEL on both MT5 and MT4. The code is shown below. The aim of this code is to write some text on indicator sub window (separate window from main window).
The funny things is this code works perfectly on Meta Trader 5 platform. Also it works well on Meta Trader 4 platform most of time.
However the problem is that I don't see the text any more when I restart Meta Trader 4 terminal (restarted after the indicator is attached on charts).
This does not happen on Meta Trader 5 terminal though.
The few clues I have found so far is:
Let me know if this couple of clues giving your some idea. So far, I don't find any logical ways of explaining this issue. Or this should be considered as bugs ?
I will really appreciate your brilliant wisdom.
Kind regards.
F.E.