Archive for August, 2012

Take screenshots at trade

August 21st, 2012

I’m kicking myself for not implementing this earlier (actually I did implement it a while ago, but didn’t start using it until a few days ago), so I thought I would share some code for once to help out anyone writing and optimizing their own MT4 strategies. I simply call this function after I have taken a position, which saves the current graph (including any information written on it) for later inspection. I have found that this greatly helps me analyse the trade afterwards.

extern int  ScreenShotWidth = 1200;
extern int  ScreenShotHeigth = 1000;
void TakeScreenShot(int ticket) {

string ScreenShotFileName = StringConcatenate(”Purple_EA_”,Symbol(),”_”,DoubleToStr(ticket,1),”.gif”);

if (WindowScreenShot(ScreenShotFileName,ScreenShotWidth,ScreenShotHeigth)) {

//WriteLog(”Screenshot taken: “+ScreenShotFileName);


else {

//WriteLog(”Screenshot failed: “+DoubleToStr(GetLastError(),1));



Just call the method with the ticketnumber of the trade. This will dump the current graph and all eventual indicators and visible objects to a screenshot.