I think you are overthinking the problem. Set up the chart the way you want. Save as the default template (Default.tpl)
When the button is pressed, change the chart. Deinit doesn't have to do anything. When the new chart starts, the template sets everything.
Done.
I think you are overthinking the problem. Set up the chart the way you want. Save as the default template (Default.tpl)
When the button is pressed, change the chart. Deinit doesn't have to do anything. When the new chart starts, the template sets everything.
Done.
Hi William, thank you so much for your answer.
I think that I didn't make myself clear. My bad. I'd like to keep the forex pair open in the chart and modify the button of the pair selected with a strong background in the button. The same with the timeframe selected (example1.png and example2.png are attached).
Every time I change the pair using the button of my indicator, the background color of those buttons are reset.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- 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 everyone!
I'm coding an indicator and I'm encountering a problem. My idea is to have this indicator attached to a chart in a separate monitor just to use it to manage the open trades in each forex pair but I'm having trouble when I switch symbols. I know that the function ChartSetSymbolPeriod call the OnDeInit function in the current chart and call the function OnInit in the next chart (when I switch symbols).
I'd like to keep some information such as what symbol is selected by using a background property of the button (panel.PNG attached as an example).
I already found in this forum some people with almost the same problem and someone recommended to save the information to a file, so in the function OnInit I will check if the file exists, if yes, I'll read the parameters saved there to load my indicator and in the OnDeInit, I'll save the parameters that I want to be load in the next chart when I switch symbol. Or I could create global variables but honestly I don't think I should use global variables in this case.
What do you guys recommend?
Thanks in advance!