Download MetaTrader 5

Problem with the delay of ChartSetSymbolPeriod()

To add comments, please log in or register
mar
1148
mar  

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
16093
whroeder1  
Change the period and return. After the terminal switches, then take the next screenshot.
mar
1148
mar  

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