Is there a way to get/set the default background color of a chart in mql4?
No, because MQL4 has no default background. You only can get and set the background of the chart the EA is attatched to.
You can set the background in the MT4 default template. There are also templates for debuging and testing - see documentation.
1. As far as i know, if you apply a template to the same chart the program is running, the program will be removed from the chart.
2. Thanks for clearifying and the details.
Then use ChartSetInteger() as WHRoeder has suggested!
2. ChartSetInteger - Chart Operations - MQL4 Reference using chart_color_background
Ehm, I already intend to use ChartSetInteger() to set the background color, but the question was not how to set the background color, but how to get/set the default background color.
As indirectly suggested by WHRoeder one could apply the default template - which would apply the default background color - and then get the default background color with ChartGetInteger(). But the operation of using ChartApplyTemplate, as mentioned, would have unwanted consequences.
You still don't understand. The default template ("default.tpl") does not need to be applied either manually or via ChartApplyTemplate() because it is the default template.
When you open any new Chart, the default template is automatically applied, therefore the default background color is what is in the "default.tpl" file.
So, just setup a new chart as you wish it to be (change colours, scaling, volume, indicators, etc.) and then save it to the default template "default.tpl". From that moment on, any new charts opened, will have those default everything.
To add comments, please log in or register