Anybody Please!
Raaneip:
Anybody Please!
Anybody Please!
It's because when you apply the template, you already have a label with a given name and your indicator which is also applied with the template, try to recreate an object with the same name.
if(!lblMyLabel.Create(m_chart_id,"lblMyLabel"+m_name, m_subwin,10,5,50,22))
angevoyageur:
It's because when you apply the template, you already have a label with a given name and your indicator which is also applied with the template, try to recreate an object with the same name.
Thank you very much angevoyageur.
So I edited the .tpl file and removed all the definitions of the objects in it but left the "definition" of the "indicator" in it and voila it gets displayed.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I have the following simple custom indicator based on the class CAppDialog.
It creates a instance of MyAppDialog derived from CAppDialog.
MyAppDialog in turn creates a instance of MyWndContainer derived from CWndContainer.
MyWndContainer then creates an instance of a CLabel.
If I now add this indicator to a chart and save it as a template and try to load the template on a different chart, it displays the subwindow but the dialog does not get displayed.
If I comment out the code creating the CLabel on the MyWndContainer and repeat the template process it does get displayed.
Just for testing the problem I created a CLabel on the MyAppDialog and then the error does not occur.
Included is the code :
For the Indicator:
For the MyAppDialog class:
For the MyWndContainer class:
If I comment out the code creating the CLabel in the CWndContainer
I don't get the error when loading the indicator from a template in MetaTrader.
Any idea if there is something wrong in my coding or how to get around this problem?