Download MetaTrader 5

EA taking screenshots when trade is opened / closed

To add comments, please log in or register
Trade like successful traders - subscribe to their signals!
relaxo
28
relaxo 2013.12.30 19:03 

hello,

i would like to have a EA that makes a screenshot of the pair once i open a trade / or close the trade (manual, SL,TP)

i was trying out this one here but didnt work for me: https://www.mql5.com/en/code/10232

the email function works fine, but the screenshot does not work, i also changed the global variable to 0 or to 1, but still doesnt save the picture in the folder mt4/experts/files

does anyone can help me?



Tjipke de Vries
6316
Tjipke de Vries 2013.12.30 19:18  
Simon Gniadkowski
Moderator
18001
Simon Gniadkowski 2013.12.30 19:46  
relaxo:

hello,

i would like to have a EA that makes a screenshot of the pair once i open a trade / or close the trade (manual, SL,TP)

i was trying out this one here but didnt work for me: https://www.mql5.com/en/code/10232

the email function works fine, but the screenshot does not work, i also changed the global variable to 0 or to 1, but still doesnt save the picture in the folder mt4/experts/files

does anyone can help me?

Were the Global variables set correctly ? did you confirm ? do you have any related error messages in the Experts tab/log
relaxo
28
relaxo 2013.12.30 20:20  
RaptorUK:
Were the Global variables set correctly ? did you confirm ? do you have any related error messages in the Experts tab/log

Yes, they are both set to "1"



The description as well as the code also works that way as far as I see it:




Yes, I've seen this, but I would like to have only screenshots once a trade is opened, or closed.

Tjipke de Vries
6316
Tjipke de Vries 2013.12.30 20:26  
relaxo:


deVries:
See Taking a periodic screenshot in Mt4 (every 5 mins)


Yes, I've seen this, but I would like to have only screenshots once a trade is opened, or closed.


do i understand you don't know how to check if a trade of your EA is opened, or closed ??
relaxo
28
relaxo 2013.12.30 20:34  
deVries:

do i understand you don't know how to check if a trade of your EA is opened, or closed ??

I'm not sure about your question?

I don't want the EA to open or close any trades, it will be manual trading by myself. However, I want the Screenshot-EA which is basically there (post #1) to screencapture it once a trade is closed or opened.


To see if a trade is opened I can go to the journal tab and simply see what was opened, modified or closed. I'm not into the mql4 language, but I can see that it must work correctly with the code, because the function works properly fine for the e-mail function, and it's the same runthrough, the WindowScreenshot is basically just an additionally method which is also run-through in the code.

So it seems to me that either my broker/metaquotes MT4 doesn't allow the function screenshot (WindowScreenShot) anymore (however i've tried it with a few brokers already), or I am still missing sth. here that the WindowScreenShot will also work for me.

relaxo
28
relaxo 2013.12.30 20:38  

I just found out about the problem, the screenshot is actually saved under AppData/Local/VirtualStore etc.


How can I change the code to add a screenshot function once a trade is closed

and

How can I change the path in the code to manually put in a destination for the screens?

Ubzen
5394
Ubzen 2013.12.30 20:55  
relaxo:

I just found out about the problem, the screenshot is actually saved under AppData/Local/VirtualStore etc.


How can I change the code to add a screenshot function once a trade is closed

and

How can I change the path in the code to manually put in a destination for the screens?


1) There's lots of ways. One way is checking OrdersTotal() count decreased. Or that OrdersHistoryTotal() increased. You need to learn to perform a basic OrderSelect() Loop because most times you need to distinguish between what just closed vs canceled vs manual vs expert advisor etc. Search the forum for info about OrderSelect() Loops. If you're still confused then try reading the Book.

2) You cannot change the sandbox destinations with mql4. You could possibly move/copy the file to a different location using .dlls.

relaxo
28
relaxo 2013.12.31 18:27  

Found an alternative that has the open and close screenshot function already integrated. (indicator below attached)

it works fine and i also managed to first make the screenshot with the arrows of entry and exit when a trade is closed (when a screenshot will be made), and afterwards being deleted by adding this code:

string name;
for(int i = ObjectsTotal(); i >= 0; i--)
{
name = ObjectName(i);
if(ObjectType(name) == OBJ_ARROW)
ObjectDelete (name);

}


however, now i have the problem that everytime i switch the timeframe, a new picture is created (when a trade is open at a pair). it did not happen with the EA above.

what do i need to add that the picture of a trade for 1 pair will be only taken once, and if i switch timeframes, wont do it again?!

To add comments, please log in or register