Microsoft no longer supports DDE. But the same is still
widely used, and this is perticularly true when it comes to the market, where
DDE is widely used to send and receive data between two applications. Since NinjaTrader is
built on .Net, DDE is natively not available. But since NinjaScript is all about C#
and lets one to harness the full potential of the same, we can always make
something in these lines.
There is already on open source DDE library for .Net, namely
NDDE, which can be used to make
a DDE
connection for any .Net application. I am using the NDDE library to make any DDE link.
Here the sample Ninjacript will basically act as a DDE
server, and will broadcast the data. What it essentially means is any other
application, like say, Excel can receive the data, which we choose to send, from
NinjaTrader.
Here in the sample NinjaScript one can send Bid, Ask and Last quotes. The DDE
Server and Topic is same and is the symbol/instrument name. While the DDE Item
is Ask, Bid or Last as the case may be. But one
can always customized the names and the data one wish to send by editing the
NinjaDDE dll and the DDE NinjaScript.
How to install:
1. Extract the downloaded zip file and copy paste the
NDde.dll and NinjaDDE.dll files to the
NinjaTrader My Documents custom folder (example: <My
Documents>\NinjaTrader 7\bin\Custom\"). And do make sure NinjaTrader is
closed while you are copying the files.
2. Start NinjaTrader.
3. The DDE.zip file is the NinjaScript. Import the same to NinjaTrader. In
NinjaTrader goto Files > Utilities > Import NinjaScript... and follow the
procedure.
4. Open any chart, say ES and then apply the indicator "DDE".
5. Open any client application, say Excel to receive the data. The sample
NinjaScript allows you to receive Last, Ask and Bid prices. In Excel (our client
application) type in
=ES|ES!Last
in cell
A1
=ES|ES!Bid
in cell
A2
=ES|ES!Ask
in cell
A3
You can choose any three cells as per your choise. This
will fetch the Last Traded Price, Bid and Ask for ES to Excel. If you are using
any other symbol then use that symbol/instrument name in place of ES. The basic
DDE formula is =<symbol/instrumnet
name>|<symbol/instrument
name>!Last/Bid/Ask
|