Download MetaTrader 5

Problem with the delay of ChartSetSymbolPeriod()

To add comments, please log in or register
What is MetaQuotes ID? Find that out from the article!
mar
1146
mar 2016.03.20 18:44 

Hi coders,

the H1 chart is open. Now I would like to have screenshots from H1, M15 and H4. I do it this way:

ChartScreenShot(0, _Symbol+(string)_Period+".png", 1280, 720);
ChartSetSymbolPeriod(0, NULL, PERIOD_H4);
ChartScreenShot(0, _Symbol+(string)_Period+".png", 1280, 720);
ChartSetSymbolPeriod(0, NULL, PERIOD_M15);
ChartScreenShot(0, _Symbol+(string)_Period+".png", 1280, 720);

As you surely know, that doesn't work because ChartSetSymbolPeriod() works asynchronous and doesn't wait for the timeframe to be changed before continuing with the code. So the result is only one screenshot of the current timeframe.

Can someone help me to solve this problem in any other way?

Thanks in advance! 

whroeder1
14466
whroeder1 2016.03.20 19:59  
Change the period and return. After the terminal switches, then take the next screenshot.
mar
1146
mar 2016.03.20 21:58  

Ok, then I can't do a script with this. If I need to return it then it can only be done with an indicator or EA.

Thanks mate! 

To add comments, please log in or register