Open a new chart (ChartOpen) with the desired timeframe, set a template, capture the chart (and close the chart, if you do not like it open).
Thanks, Ovo. That almost works. Now I have the problem that the M1 data is not fully loaded before the screenshot and therefore the M1 screenshot does not show the current chart. I tried RefreshRates() before the screenshot but that didn't help. Do you have an idea?
mar:
Thanks, Ovo. That almost works. Now I have the problem that the M1 data is not fully loaded before the screenshot and therefore the M1 screenshot does not show the current chart. I tried RefreshRates() before the screenshot but that didn't help. Do you have an idea?
Thanks, Ovo. That almost works. Now I have the problem that the M1 data is not fully loaded before the screenshot and therefore the M1 screenshot does not show the current chart. I tried RefreshRates() before the screenshot but that didn't help. Do you have an idea?
You can use Sleep command in the script, to allow a few seconds for data fetching. Or you may have another indicator which just calls iBars(_Symbol, PERIOD_M1) in OnCalculate; it will keep the M1 up to date.
Great idea with the other indicator. Just modified a standard indicator which runs all the time. Thank you!
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
Hi forum,
I made a script which should change the current timeframe to M1, then make a screenshot and change the timeframe back to the original one. But I always get a message from metatrader if the script should be terminated. I read in the documents that ChartSetSymbolPeriod() is asynchronous and doesn't wait for its execution completion. I believe this is the problem here. Can anyone help me?