ChartScreenShot() is saving the files as empty

To add comments, please log in or register
wilson_wilson
115
wilson_wilson  

hi there

‌‌I am noticing that ChartScreenShot() is saving the files as empty (i.e. zero byte files), anyone noticing a similar result ? ChartScreenShot () function returns true btw and I am using the latest build of 1052.

I am using the following code :

int OnStart(){

     long chartid;

     chartid=ChartOpen("EURUSD",PERIOD_H1);

     string file="picture.gif";

     Alert("screenshot =",ChartScreenShot(chartid,file,800,600));

     return(0);

}‌

t‌hanks

w‌ilson

Alain Verleyen
38519
Alain Verleyen  

The new chart (ChartOpen) has no time to be opened yet. Add a Sleep(10) or something.

wilson_wilson
115
wilson_wilson  
Alain Verleyen:

The new chart (ChartOpen) has no time to be opened yet. Add a Sleep(10) or something.



Ive tried Sleep(5000) after opening chart and it still does not work :(
honest_knave
Moderator
2306
honest_knave  
wilson_wilson:

Ive tried Sleep(5000) after opening chart and it still does not work :(

That code works fine for me... is the chart opening as it should?
wilson_wilson
115
wilson_wilson  
honest_knave:

That code works fine for me... is the chart opening as it should?

Yes, the chart is opening as it should, btw I think I might know what the problem is ... the code seems to work if I use it on a windows platform but not when I use it on my mac !
Vo Mai Chi
3278
Vo Mai Chi  

dear all, I got the same problem.

With the same function it works well in Script mode and live mode. However in backtest mode I get all empty files.

have you overcome this problem?

I just include this function on ExpertMACD.mql5 and capture chart for every new completed bar:

void TakePicture(string patternName)
//+------------------------------------------------------------------+
  {
    MqlDateTime tm;
    TimeToStruct(TimeCurrent(),tm);
    string filename= "ChartScreen\\" + IntegerToString(tm.year)
        + "\\"+Symbol()+"\\"+IntegerToString(tm.mon)
        + "\\"+IntegerToString(tm.day)+"\\"+IntegerToString(tm.hour)
        + "_"+IntegerToString(tm.min)+ "." + patternName + ".BMP";
   
    int chartHeight = (int)ChartGetInteger(0, CHART_HEIGHT_IN_PIXELS, 0);
    int chartWidth = (int)ChartGetInteger(0, CHART_WIDTH_IN_PIXELS, 0);
   
    bool scCapture=ChartScreenShot(0, filename, chartWidth, chartHeight, ALIGN_RIGHT);
    if (scCapture) {
        PrintFormat("Take screenshot successful ");
    } else {
        PrintFormat("Take screenshot failure");
    }
   
  }



Files:
To add comments, please log in or register