FORUMS BROKERS SOFTWARE
Home
 
    Forums > Technically Speaking > Automated Trading > IB syntax for DDE links in VBA

Old Feb 11th, 2011, 01:31 PM   #1
jtrader33
 
 
Join Date: Jun 2005
Posts: 397
I'm trying to avoid putting DDE links directly into Excel cells and instead establish the links in VBA and store the returned data into a VBA array. I'm getting tripped up on the very first step however, because I can't establish the DDE links in VBA (and as a result receive no data to populate my array with). Here is what I am trying to use into to get the market data via DDE:


Sub GetMktData()
Dim chan As Long, App as String, Topic as String, data As Variant, Item as String

App = "Account123"
Topic = "tik"
Item = "id1?bid"

chan = Application.DDEInitiate( App, Topic )
data = Application.DDERequest( chan, Item )
MsgBox(data(1))
Application.DDETerminate chan

End Sub

I've tried numerous variations of 'Item', but 'data' always returns as empty. (I suspect that the problem lies in what I am using for 'Item', but I'm not certain.) Does anyone have suggestions on how I can get this to work or what I'm doing wrong? Could be a problem with the general approach, but my feeling is that it is an IB specific syntax issue. I've tried gettting answers from IB customer service but would have been better off using a ouija board. Appreciate any suggestions.
    Quote
Old Feb 11th, 2011, 01:42 PM   #2
TraDaToR
 
 
Join Date: Dec 2006
Location: Lausanne, Switzerland
Posts: 4,116
I must be stupid but I thought you needed to enter the formula in an excel cell to create a DDE link, be it to retrieve datas, submit orders or anything else.
    Quote
Old Feb 11th, 2011, 01:56 PM   #3
jtrader33
 
 
Join Date: Jun 2005
Posts: 397
Quote:
Quote from TraDaToR:

I must be stupid but I thought you needed to enter the formula in an excel cell to create a DDE link, be it to retrieve datas, submit orders or anything else.
Ha. Don't worry, I'm sure when this is resolved one way or the other, I'll be the stupid one. Anyhow, I believe the above method should return into the 'data' variable the same information that would populate an Excel cell with formula:

=Account123|tik!id1?bid
    Quote
Old May 15th, 2011, 09:24 AM   #4
Alex123
 
 
Join Date: Apr 2011
Posts: 23
Hi, bs2167.

Have you found a solution for importing DDEs straight into VBA arrays yet? I'm looking to do the same and would appriciate any pointers you might have on this. Thanks
    Quote
Old May 15th, 2011, 09:31 AM   #5
Alex123
 
 
Join Date: Apr 2011
Posts: 23
Hi, bs2167.

Have you found a solution for importing DDEs straight into VBA arrays yet? I'm looking to do the same and would appreciate any pointers you might have on this. Thanks

PS Sorry if this is a duplicate - didn't see the first one come up.
    Quote
Old May 16th, 2011, 02:50 PM   #6
Alex123
 
 
Join Date: Apr 2011
Posts: 23
OK, so far I have noticed that is you first set up a Control Link (that's the one that has SecType, Exchange, Currency etc in it) in a spread-sheet, you can then get data using your syntax in VBA. Maybe the Control Link should go somewhere in DDEInitiate or DDERequest to get it all done in VBA only.. Haven't figured out where and using what syntax yet... That's one sh1t reference guide that IB has for DDE - not even a mention of either DDEInitiate or DDERequest in it.
    Quote
 
Reply
Thread Tools

Forum Jump



   Conduct Rules   Privacy Policy   Sitemap Copyright © 2014, Elite Trader. All rights reserved.   

WHILE YOU'RE HERE, TAKE A MINUTE TO VISIT SOME OF OUR SPONSORS:
Advantage Futures
Futures Trading & Clearing
AMP Global Clearing
Futures and FX Trading
Collective2
Automated Trading Services
CTS
Futures Trading Software
dom993trading.com
NinjaTrader Consulting
eSignal
Trading Software Provider
FXCM
Forex Trading Services
Global Futures
Futures, Options & FX Trading
Interactive Brokers
Pro Gateway to World Markets
JC Trading Group
Direct Access Trading
MB Trading
Direct Access Trading
NinjaTrader
Trading Software Provider
optionshouse
Option Trading & Education
Rithmic
Futures Trade Execution Platform
SpeedTrader
Direct Access Trading
SpreadProfessor
Spread Trading Instruction
thenut-trader.com
FX, Gold, & Stock Signals
TradersStudio
System Building & Backtesting
Tradier
Equity and Options Trading
Trading Technologies
Trading Software Provider