Download MetaTrader 5

Communicating with MT5 with external app

To add comments, please log in or register
Share your program via Code Base. Gain access to millions of traders!
olddirtypipster
27
olddirtypipster 2013.02.05 21:50 
Is there a way to communicate with MT5 with an external application? For example, I would like to command MT5 to close a trade via an external application. I was thinking of getting the chart window handle and then use this window handle to do a SendMessage(hWnd...) or PostMessage(hWnd...) to the chart window via the external app. But is there a better way? One would have thought the MT5 has built in event polling capabilities, but I haven't seen these. Any novel ideas? Thanks.
Documentation on MQL5: Standard Constants, Enumerations and Structures / Chart Constants / Chart Properties
Documentation on MQL5: Standard Constants, Enumerations and Structures / Chart Constants / Chart Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Chart Constants / Chart Properties - Documentation on MQL5
Ahmed Soliman
15611
Ahmed Soliman 2013.02.06 05:51  

Your approach is not bad.

Another aporoach to write to registery from your appication and make an EA that reads the registry.

phi nuts
2184
phi nuts 2013.02.11 02:47  
olddirtypipster:
Is there a way to communicate with MT5 with an external application? For example, I would like to command MT5 to close a trade via an external application. I was thinking of getting the chart window handle and then use this window handle to do a SendMessage(hWnd...) or PostMessage(hWnd...) to the chart window via the external app. But is there a better way? One would have thought the MT5 has built in event polling capabilities, but I haven't seen these. Any novel ideas? Thanks.

Better way ? using WinAPI like that (PostMessage... SendMessage) is better than other method.

OnTimer event calling .dll or some file in each second, could be an alternative.

To add comments, please log in or register