Attaching EA to the chart via command line

 

Hi,

I am wondering if it is possible to attach EA to the chart (and enable live trading), via command line, or any other means besides actually opening chart and manually attaching EA to it.

I would like to automate this process and do not want to have human interaction in this step.


Any ideas are welcomed.


Thanks

emeded

 

use autoit3

or QuickMacro for simpler

but most anti-virus will assume quickmacro as virus

and differnet Monitor Resolution may cause comptability

 
emeded:

I am wondering if it is possible to attach EA to the chart (and enable live trading), via command line, or any other means besides actually opening chart and manually attaching EA to it.

I would like to automate this process and do not want to have human interaction in this step.

It depends whether MT4 is not currently running, and you want to start it with an EA automatically running, or whether MT4 is already active and you want to open a new chart or attach an EA to an existing chart.


The former - starting up MT4 with a specific configuration - is easy. Have a look in the software's help file under Tools/Configuration at startup.


The latter - changing the charts in a copy of MT4 which is already running - is somewhere between very hard and impossible. There is a way for MQL code to attach an indicator/script/EA to a chart (see 'Execute an existing EA from a script/ea ?') but this doesn't let you open new charts, and it doesn't work across process boundaries. You could potentially build a mechanism (using something like EAQueue) which gets MT4 to listen to commands from an external program, but you'd still be hamstrung by the fact that you could add an EA to an existing chart, but there'd still be no way of opening new chart windows.


Alternatively, you could try the sort of scripting tools which kelly is suggesting. But these depend on simulating keystrokes and mouse clicks, and are very likely to be unreliable.

Reason: