WindowScreenShot shifts the image

 

Hi

The code below is expected to take the screen shot of the chart window as is, but when I shift the chart window x number of bars, it still takes the image as if the chart is not shifted, It also shifts my custom indicator so that it does not align with the chart bars correctly, which is not showing.

Any idea how to take the screen shot as it appears on the screen?

Windows 10 pro laptop

Thanks


void OnChartEvent(const int id,         // Event identifier  
                  const long& lparam,   // Event parameter of long type
                  const double& dparam, // Event parameter of double type
                  const string& sparam) // Event parameter of string type
{
//--- the left mouse button has been pressed on the chart
   if(id==CHARTEVENT_CLICK){
      if(!WindowScreenShot("shots\\" +Symbol() + ".gif",1536, 864)){
         Print("error: " + GetLastError());
      }
   }
   
}
Files:
original.PNG  76 kb
withCode.gif  24 kb