Use an EA to take a windown shot for each order (the order is open manually)

 

Folks

1) I am an EA developer and FX trader
2) I want keep every opened orderscreen shot for review (Trainng)
3) I use the following code to check the file which is existing, but something wrong, becuase the file will be open then some error.

ticket=OrderTicket();
filename = ticket

if(FileOpen(filename,FILE_CSV|FILE_READ) < 1 )
{

if(!WindowScreenShot(filename,640,480)) Print("WindowScreenShot error: "+GetLastError());
}
else
{
FileClose(FileOpen(filename,FILE_CSV|FILE_READ));

}

finally, I want some code,it simple

if file is not exist, thake WindowScreenShot

Anyboby can help me, thanks

 
You have to save the file handle like so:
int handle = FileOpen(filename,FILE_CSV|FILE_READ);
if( handle<1 )
   // save screenshot
else
   FileClose(handle);

Next time:
 

Gordon, Thanks. I tarial now.

 

Gordon,

Your code is fine, the problem of my code is don't close the file (this mean the file is always opening ) then cannot delete the file .

Thanks.

 

Gordon,

There are something wrong

filename = ticket()+"_Open.gif";

int handle = FileOpen(filename,FILE_CSV|FILE_READ);
if( handle<1 )
// save screenshot
else
FileClose(handle);


________________

The above code always take screen shot every tick ! I want take once only, how to solve ?

Thanks.

 
VictorCheong78:

Gordon,

There are something wrong

filename = ticket()+"_Open.gif";

int handle = FileOpen(filename,FILE_CSV|FILE_READ);
if( handle<1 )
// save screenshot
else
FileClose(handle);


________________

The above code always take screen shot every tick ! I want take once only, how to solve ?

Can u copy paste your original code... And please use the SRC button.
Reason: