As per the rules, you can't publish Market products that use DLL calls, even if they are for Windows API.
Rules of Using the Market Service
2. Products must not contain calls to any DLL, including Microsoft Windows system libraries.
To set the chart properties (e.g. candle colour), simply use the following functionality (it is supported in MQL4, and I tested it moments ago) ...
Sets the double value for a corresponding property of the specified chart
Sets the integer value (datetime, int, color, bool or char) for a corresponding property of the specified chart
Sets the string value for a corresponding property of the specified chart
Then you can save it as a template with ...
Saves current chart settings in a template with a specified name
As per the rules, you can't publish Market products that use DLL calls, even if they are for Windows API.
Rules of Using the Market Service
2. Products must not contain calls to any DLL, including Microsoft Windows system libraries.
To set the chart properties (e.g. candle colour), simply use the following functionality (it is supported in MQL4, and I tested it moments ago) ...
Sets the double value for a corresponding property of the specified chart
Sets the integer value (datetime, int, color, bool or char) for a corresponding property of the specified chart
Sets the string value for a corresponding property of the specified chart
Then you can save it as a template with ...
Saves current chart settings in a template with a specified name
thanks. solved
As per the rules, you can't publish Market products that use DLL calls, even if they are for Windows API.
Rules of Using the Market Service
2. Products must not contain calls to any DLL, including Microsoft Windows system libraries.
To set the chart properties (e.g. candle colour), simply use the following functionality (it is supported in MQL4, and I tested it moments ago) ...
Sets the double value for a corresponding property of the specified chart
Sets the integer value (datetime, int, color, bool or char) for a corresponding property of the specified chart
Sets the string value for a corresponding property of the specified chart
Then you can save it as a template with ...
Saves current chart settings in a template with a specified name
The issue is that I cannot remove indicators and EAs from the Default template mt4. Can I load someway the "mt4 default" template bypassing default.tpl if the users has created it?
any better idea?
The issue is that I cannot remove indicators and EAs from the Default template mt4. Can I load someway the "mt4 default" template bypassing default.tpl if the users has created it?
any better idea?
As per the rules, you can't publish Market products that use DLL calls, even if they are for Windows API.
Rules of Using the Market Service
2. Products must not contain calls to any DLL, including Microsoft Windows system libraries.
To set the chart properties (e.g. candle colour), simply use the following functionality (it is supported in MQL4, and I tested it moments ago) ...
Sets the double value for a corresponding property of the specified chart
Sets the integer value (datetime, int, color, bool or char) for a corresponding property of the specified chart
Sets the string value for a corresponding property of the specified chart
Then you can save it as a template with ...
Saves current chart settings in a template with a specified name
Hello Fernando
can you confirm that there is no solution for the issue I raised? see my last message please.
Thanks a lot
Forgive me, but I do not fully understand your issue or question.
There is both a "save" and an "apply" function if that helps you ...
And if you want to have a different "Default", you can also overwrite the "default.tpl" with a new one using ChartSaveTemplate.
Applies a specific template from a specified file to the chart
Saves current chart settings in a template with a specified name
Forgive me, but I do not fully understand your issue or question.
There is both a "save" and an "apply" function if that helps you ...
And if you want to have a different "Default", you can also overwrite the "default.tpl" with a new one using ChartSaveTemplate.
Applies a specific template from a specified file to the chart
Saves current chart settings in a template with a specified name
The issue is that I can only apply the chart settings to a chart and mt4 would load the "default" to start, change colors and save the templates; mql4 doesn't allow to simply save a full template file into Templates folder (in files yes) and mql5 doesn't allow to move the templates using windows API; Apply templates works only from Templates folder and not fom files. if the users has created the default.tpl and in this template he has indicators and EA in mql4 I cannot delete them. So I can change colors to bars, backgrouond.. etc but it would keep the indicators and EA and this is not really practical. Am I wrong?
The issue is that I can only apply the chart settings to a chart and mt4 would load the "default" to start, change colors and save the templates; mql4 doesn't allow to simply save a full template file into Templates folder (in files yes) and mql5 doesn't allow to move the templates using windows API; Apply templates works only from Templates folder and not fom files.
I still don't understand the problem because ChartSaveTemplate saves the template to "data_folder\templates\ ", not "files\" (unless you are doing something incorrectly).
All you have to do is programmatically set up the chart as you want it then save it to a template with ChartSaveTemplate. It is as simple as that.
Show your code if you want a more useful answer.
You can remove indicators with ...
Removes an indicator with a specified name from the specified chart window
I don't remember if there is am EA removal function, but your EA should be the only one running on the current chart anyway, so there is no other EA to remove except your own.
If however, your issue is something else which you have not explained very clearly, then an alternative is to first apply another "clean" template to the chart first, before configuring it your way. Or a simpler solution, is just to request to "clear" the default template or you can supply them with template files.
I still don't understand the problem because ChartSaveTemplate saves the template to "data_folder\templates\ ", not "files\" (unless you are doing something incorrectly).
All you have to do is programmatically set up the chart as you want it then save it to a template with ChartSaveTemplate. It is as simple as that.
Show your code if you want a more useful answer.
You can remove indicators with ...
Removes an indicator with a specified name from the specified chart window
I don't remember if there is am EA removal function, but your EA should be the only one running on the current chart anyway, so there is no other EA to remove except your own.
If however, your issue is something else which you have not explained very clearly, then an alternative is to first apply another "clean" template to the chart first, before configuring it your way. Or a simpler solution, is just to request to "clear" the default template or you can supply them with template files.
The issue is that I want to create my own clean templates for my EA without relying on users. I use these templates for sending screenshots, and if I cannot control the templates creation 100% the result will be quite awkward. and users will not understand that this an mt4 limitation.. ChartIndicatorDelete deletes specific indicator if you know what indicators are loaded and I wasn't able to query the indicators names of the loaded chart and then delete to have a solution valid for all.
ChartSaveTemplate starts from an active chart (default) where you cannot remove EAs and indicators so the result is a template with my colors but indicators and EAs from the users.. not ideal!
At template creation so far I am showing a popup asking to temporarly rename the default.tpl in order for the EA to start from the clean mt4 template.
Regarding files, Mt4 is able to save an hard coded tpl in files (savefile), but cannot save in Templates that would be the easy solution ... not allowed.. I had developed a 2 step approach Save to files and then move to Templates via API but I got the surprise at ex4 upload... not allowed.
The issue is that I want to create my own clean templates for my EA without relying on users. I use these templates for sending screenshots, and if I cannot control the templates creation 100% the result will be quite awkward. and users will not understand that this an mt4 limitation.. ChartIndicatorDelete deletes specific indicator if you know what indicators are loaded and I wasn't able to query the indicators names of the loaded chart and then delete to have a solution valid for all.
ChartSaveTemplate starts from an active chart (default) where you cannot remove EAs and indicators so the result is a template with my colors but indicators and EAs from the users.. not ideal!
At template creation so far I am showing a popup asking to temporarly rename the default.tpl in order for the EA to start from the clean mt4 template.
Regarding files, Mt4 is able to save an hard coded tpl in files (savefile), but cannot save in Templates that would be the easy solution ... not allowed.. I had developed a 2 step approach Save to files and then move to Templates via API but I got the surprise at ex4 upload... not allowed.
Then instead of using a template, simply clean up the chart on which the EA is loaded. No need to mess around with templates. There will be no other EA running on it except your own.
To remove all indicators, just scan over them and remove each one ...
Removes an indicator with a specified name from the specified chart window
Returns the short name of the indicator by the number in the indicators list on the specified chart window
Returns the number of all indicators applied to the specified chart window.
You really need to learn to read the documentation and do your own research. How do you think I found out?
I didn't know until now. I've never used it before until you asked.
I simply looked at the available functions for chart operations, and read each one that seemed related, to find out what they do and how they work.
So please, dedicate some time and read the documentation.
And don't complicate things for yourself.
Follow-up (a simpler solution):
It seems there is simpler solution to your issue, and it is a documented method. According to the documentation for the ChartApplyTemplate function, the template does not necessarily have to be located in the "Templates" directory. It can be sourced from different locations. Here is an excerpt from the documentation ...
The ChartApplyTemplate() function is intended for using a previously saved template, and it can be used in any mql4 program. The path to the file that stores the template is passed as the second parameter to ChartApplyTemplate(). The template file is searched according to the following rules:
- if the backslash "\" separator (written as "\\") is placed at the beginning of the path, the template is searched for relative to the path _terminal_data_directory\MQL4,
- if there is no backslash, the template is searched for relative to the executable EX4 file, in which ChartApplyTemplate() is called;
- if a template is not found in the first two variants, the search is performed in the folder terminal_directory\Profiles\Templates\.
So, in essence you can create a clean template in the "Files" directory, using standard file operations to create and write the file, and then you can apply it using the above method described in the documentation.
Update:
It seems that the same file naming rules that apply to ChartApplyTemplate, also applies to ChartSaveTemplate, even though it is not documented. You can also save templates to the other directories.
So, in essence you can save a template to the "Files" directory, and then read and process the file to find out details about the chart, EA or indicators on it, as well as the parameters for those programs.
I have not fully tested it, but at least the following example works and saves to the "Files" directory.
ChartSaveTemplate( 0, "\\Files\\TemplateTest" );

- docs.mql4.com

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
hello all.
I have created an EA that creates some templates in "files" and moves them into the Templates folder using Windows API (as I can't write into Templates); when I tried to publish in the market, MQL5 rejected it.
Some days ago I saw a post where it was provided exactly this recommendation to a user in 2021.. do you know if there's a process allowed or an alternative way? have rules changed? Any other way?
I tried applying colors, layout etc to the chart but also many functions, "eg color br up and down" are not supported by mt4 and the final result is impacted by the default template of the users... any better idea to force fully a template in mt4?
thanks a lot for your help!