void OnStart() { ... long IDChart = ChartOpen( "EURUSD", PERIOD_H1 ); // opens new chart if ( !ChartApplyTemplate( IDChart , "templateName" ) ) { ChartClose( IDChart ); } // appl. template or kill chart else ChartClose( ChartID() ); // closes the chart of the script ... }PS: Do not try to save the Chart-ID as global variable, Glob-Vars are Double, ChartID are long and generally too big and so the values will differ :( (its a feature not a bug!)
PS: Do not try to save the Chart-ID as global variable, Glob-Vars are Double, ChartID are long and generally too big and so the values will differ :( (its a feature not a bug!)
A workaround might be to split it and save it as 2 GV's
Hello Gooly,
thanks for your quick answer. But Im not sure what you mean by "Do not try to save...". Ive copy and pasted your code into a new script file (deleted ...), but it didnt work. There was a warning called `IDChart`-undeclared identifier. Thanks for your solution.
Hello Gooly,
thanks for your quick answer. But Im not sure what you mean by "Do not try to save...". Ive copy and pasted your code into a new script file (deleted ...), but it didnt work. There was a warning called `IDChart`-undeclared identifier. Thanks for your solution.
1) I forgot to declare long IDChart (I was using a global definition, I have changed it now)
2) I was trying to use the Glob.Vars. for a kind of inter-chart-communication: use a parameter-set which is not jet used on a different chart.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Thanks a lot.