Can I feed WL list of symbols to IB Workstation?
Author: josvanboxtel
Creation Date: 8/8/2012 10:48 AM
profile picture

josvanboxtel

#1
Can anyone tell me how to feed WealthLab strategy results, actually the list of Symbols under the Trades tab, to IB Trader Workstation. I want to use a predefined list of symbols as input for trading the gap at market opening. TWS does not allow me to manually enter a list of symbols. Any advice is much appreciated.
profile picture

Eugene

#2
Export the list of symbols to a file, and then Import Tickers from a File on TWS side?

Also, IB has an API that lets you communicate with TWS via DDE, sockets, ActiveX etc.
profile picture

josvanboxtel

#3
Thanks Eugene, this works. I just mist the import function in TWS.
profile picture

Cone

#4
QUOTE:
how to feed WealthLab strategy results,
Here's something I've used with success in the past for importing trades into a Basket. You just open the Basket Trader and import the file, which will be saved to ..\Data\Alerts\..

Note! If you use this, you have to be careful about clicking individual symbols after running the scan for Alerts since it will change the results in the file.

CODE:
Please log in to see this code.
profile picture

abegy

#5
Is it possible for you to add this code in the Community Components ?
At the same time, I would be great if you can have the "import real (historical) trades" adapted to read IB Trade files :-)
Thanks a lot
profile picture

Cone

#6
Support like this for specific brokers is not going to find its way into Community.Components.

Besides, edits are required to get the desired behavior (this is just a starting point). It's pretty to copy the routine to strategies that you require, but you're also welcome to compile a library for you own personal use.
profile picture

hankt

#7
For anyone attempting to use this bit of code, don't forget to add at the top of your code a bit for System.IO

CODE:
Please log in to see this code.

profile picture

hankt

#8
Cone,

This creates a data file with too many alerts for me. Each position will have several alerts depending on one's code for stops (I have a couple).

Without writing a loop on top of the excel file to get the trading stop alert closest to the market price, how would one capture what ends up in the orders window?

Also, this routine creates a quantity of 1 for each line. I thought this might have to do with my placement of the call to AlretsToFile, it is indeed the last line before the end of my strategy execute closing brace.

Lastly, when this code is added to a live strategy (strategy monitor, paper account, automatically stage orders from strategy alerts checked & auto trading on the order window set to Paper Account), it doesn't execute. If I right mouse click the strategy in the strategy window and tell it to open in a new strategy window and run it, the file is produced.

Thank you for the help.
profile picture

Cone

#9
Preface: I'm not supporting this code. It's an example of how to format a file that will work for an IB Basket. And it's not useful for periodic intraday trading.

QUOTE:
Also, this routine creates a quantity of 1 for each line.
Sizing in a script will only work for Raw Profit mode or WealthScript Override.

QUOTE:
when this code is added to a live strategy (strategy monitor,
It's not designed for that. Notice this comment in the code: // Refresh file if first symbol in MSB This idea will definitely not work for intraday operation in the Strategy Monitor because you don't know which symbol will be the first to execute.
profile picture

hankt

#10
Thanks for the update.

I am a close to close strategy and have worked out most everything I need to do via code. I was hoping to get more use from my paid version of Wealth-Lab.
profile picture

cravens

#11

That code segment looks good nice.
An alternate way to get Wealth-lab orders to IB is to run your strategies and then copy the orders page (right click then copy) and then paste to an Excel sheet. Make a simple macro that manipulates the columns and saves to a file. Upload this file to the basket trader. It sounds complicated but in reality only takes about 20 seconds.

This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).