EA vs Manual Trade Operations

 
Hi guys. Can an EA be programmed to recognize when a user manually opens or closes a trade from the chart?
 
macpee:
Hi guys. Can an EA be programmed to recognize when a user manually opens or closes a trade from the chart?
Yes it can be done. Also by default the mt4/5 knows automatically if a trade was placed manually or by and EA.
 
macpee:
Hi guys. Can an EA be programmed to recognize when a user manually opens or closes a trade from the chart?
Raymond Heriel Mbowe #:
Yes it can be done. Also by default the mt4/5 knows automatically if a trade was placed manually or by and EA.

Please don't just say "It can be done".
Please explain how an EA can detect whether a trade was opened/closed manually or by an EA in MQL4.

 
macpee: Hi guys. Can an EA be programmed to recognize when a user manually opens or closes a trade from the chart?

On MT4, the only way to detect manual trades is by the magic number being zero. Most EAs will use a specific magic number other the zero, but manual trades always have zero for their magic number.

However, some EAs will specifically open trades with magic number set to zero on purpose and for these cases it will not be possible to differentiate between the two.

 
macpee:
Hi guys. Can an EA be programmed to recognize when a user manually opens or closes a trade from the chart?

So from the answers I get above, the EA will have to go through all open orders, select each order, check if the magic number is zero or not. If zero then the order was created manualy. If not then the order was created by EA.

How does the EA even know that an order was closed? Or does the EA have to check the total orders and compare with last known total order. If  new total is less than previous total then an order was closed. 

How to check if the closed order was closed manually or by EA.

Maybe I should check history total for the last closed order to get its magic number.

How do I know the selected order is the last closed. Maybe I should check the order close time and compare with the closed time of ALL orders in history. Hmmmmmmm. Laborous.

How often should the above activities be checked? Maybe the EA should do the checking whenever a chart event is triggered. It won't make sense checking it at the end of every bar since manual placing of order can be done within bar periods.

Big question!!! Does chart event include using the mouse pointer to click the close button (located at the right end) of each open order in the list of open orders?

 
macpee #: So from the answers I get above, the EA will have to go through all open orders, select each order, check if the magic number is zero or not. If zero then the order was created manualy. If not then the order was created by EA. How does the EA even know that an order was closed? Or does the EA have to check the total orders and compare with last known total order. If  new total is less than previous total then an order was closed. How to check if the closed order was closed manually or by EA. Maybe I should check history total for the last closed order to get its magic number. How do I know the selected order is the last closed. Maybe I should check the order close time and compare with the closed time of ALL orders in history. Hmmmmmmm. Laborous.

Normally EAs track their own trades based on their magic number and so know when they are closed.

However, you want to track manual trades, so yes you will have to scan all orders (with magic number 0) to detect when it is closed (irrespectively of them being closed manually or by an EA), by verifying the order's close time. For example, if the last scan was started at 10:52:13, then all orders with a close time after that time would have been closed after the last scan.

Whether you consider it is laborious or not, that is what programming is for — to carry out laborious tasks. So, create the necessary functions or classes to carry out those tasks for you.

 
As a beginner in forex, is manual trading profitable and has lower risk when compared to EA? Which has more advantages for beginner traders?
 
Jarvis89 #: As a beginner in forex, is manual trading profitable and has lower risk when compared to EA? Which has more advantages for beginner traders?

Neither one is better than the other. Each method has its advantages and disadvantages.

Selecting one or the other depends on your skill set, your knowledge and your experience, and also your psychological preferences.

 
I prefer EA trading to manual trading even though it has been around for much longer. EA trading performs complex calculations without missing out on trading opportunities and has no emotional conflicts involved.
 
I would say that if a strategy is a indicator based, then yes … EA can do the job perfectly… otherwise… I doubt that anyone can code what the professional eye can see and professional traders mind can process… My opinion is that an EA can take care of a trade, or open/close trades at specific prices/time… more like maintenance 
 
If you are a beginner, it is better to trade manually to gain experience and learn more about forex live trading so that you can develop your strategies and money management skills.
Reason: