Creating Order in MT4 after getting signal in external charting software

 
I am using a charting software similar to MetaStocks for creating buy and sell signals. The software can exchange Date via DDE.

So I am searching a way to translate the signal of the software, which would be for example "EURUSD:Enter LONG", into an order for MT4. Maybe through DDE or a DLL.
In the sript I can change Lot size and other parameters for the order.

Is anybody able to write a script for this?
 
yusef001:
I am using a charting software similar to MetaStocks for creating buy and sell signals. The software can exchange Date via DDE.

So I am searching a way to translate the signal of the software, which would be for example "EURUSD:Enter LONG", into an order for MT4. Maybe through DDE or a DLL.
In the sript I can change Lot size and other parameters for the order.

Is anybody able to write a script for this?

MT4 only has DDE server capabilities but not DDE client (so it can only send via DDE but not receive). A DDE client can be implemented in a DLL and used in experts.

 
yusef001:
I am using a charting software similar to MetaStocks for creating buy and sell signals. The software can exchange Date via DDE.

So I am searching a way to translate the signal of the software, which would be for example "EURUSD:Enter LONG", into an order for MT4. Maybe through DDE or a DLL.
In the sript I can change Lot size and other parameters for the order.

Is anybody able to write a script for this?

This is possible, but not simple. It would require fairly deep programming experience (MQL and Microsoft).

You would have to write an intermediate DDE broker. MetaStocks would send the buy/sell signals to the DDE broker, and MT4 would poll the broker for the signals. You could write an MT4 EA that made external calls to a DLL (http://www.metatrader.info/node/39) and the DLL would do the DDE heavy lifting. There would be some lag as the MT4 EA start loop is only called when it receives bid/ask from the broker, but the lag shouldn't be too bad. This lag might make it unacceptable for a tick scalping system, but most other strategies would be fine.

I'm not familiar with MetaStocks, but it may be possible to skip the DDE broker entirely by having MetaStocks log buy/sell orders to a flat file. The MT4 EA could poll the file for the orders. I know it's crude, but I'm not much of a fan of "elegant" solutions when something simple works. Also, the same lag issues as the DDE broker solution.

 
nowhoha wrote >>

This is possible, but not simple. It would require fairly deep programming experience (MQL and Microsoft).

You would have to write an intermediate DDE broker. MetaStocks would send the buy/sell signals to the DDE broker, and MT4 would poll the broker for the signals. You could write an MT4 EA that made external calls to a DLL (http://www.metatrader.info/node/39) and the DLL would do the DDE heavy lifting. There would be some lag as the MT4 EA start loop is only called when it receives bid/ask from the broker, but the lag shouldn't be too bad. This lag might make it unacceptable for a tick scalping system, but most other strategies would be fine.

I'm not familiar with MetaStocks, but it may be possible to skip the DDE broker entirely by having MetaStocks log buy/sell orders to a flat file. The MT4 EA could poll the file for the orders. I know it's crude, but I'm not much of a fan of "elegant" solutions when something simple works. Also, the same lag issues as the DDE broker solution.





Some time ago I wrote an MT4 EA to read a flat file as described above. See http://paulsfxrandomwalk.blogspot.com/2009/12/crude-api-for-metatrader-4.html

Paul
 
nowhoha: Also, the same lag issues as the DDE broker solution.
The lag problem can be reduced by having the EA run an infinite loop (with sleep some 100 milliseconds in it) in the start() function. This is explicitely allowed by mql4 specs. Bid, Ask and the other automatic variables and the rates arrays can be updated by calling RefreshRates() in every iteration.
Reason: