Multiple strategies

Discuss, post your questions about TWSLink here.

Users who just registered, please write an email to
forum@trade-commander.de
with your username mentioned.
So we can distinguish you from bots.
Thank you
board_admin
Site Admin
Posts: 244
Joined: Mon Apr 24, 2017 3:24 pm

Re: Multiple strategies

Post by board_admin »

Do you have both TS desktops running and how many ochart.exe can you see in the taskmanager ?
Thank you

sectorbets
Posts: 92
Joined: Wed Apr 26, 2017 12:41 pm

Re: Multiple strategies

Post by sectorbets »

both TS desktops are running and there is just one orchart.exe

board_admin
Site Admin
Posts: 244
Joined: Mon Apr 24, 2017 3:24 pm

Re: Multiple strategies

Post by board_admin »

So we have isolated the problem:
As TWSLink is loaded in this process (or TS loads DLLs in this process),
you can only have one TWSLink instance. So a 2nd call of CONNECT disconnects the prev. session (in your case the live connection).

Perhaps it is somehow possible to start multiple orchart processes, by changing parameters or so. You could ask TS support for this.
I am sorry, i can't provide help for this.

Summary: For multiplte TWSLink connections you need multiple TWSLink host processes.

sectorbets
Posts: 92
Joined: Wed Apr 26, 2017 12:41 pm

Re: Multiple strategies

Post by sectorbets »

You have been great -- can't fix a problem until we know where it is.

TS allows charts to run on multiple processors, although they warn that many DLL's will become erratic when using multiple processors -- I will give it a try after the close to see if it launches multiple orchart's when I turn on additional processors

board_admin
Site Admin
Posts: 244
Joined: Mon Apr 24, 2017 3:24 pm

Re: Multiple strategies

Post by board_admin »

The TWSLink won't get erratic. But what could happen is, that you are not able to control which scripts (production, development)
are running in what orchart process. But for your purpose, you need to know this.

sectorbets
Posts: 92
Joined: Wed Apr 26, 2017 12:41 pm

Re: Multiple strategies

Post by sectorbets »

I am running on a virtual machine at a large data center, and it appears that it is emulating a single processor, so I couldn't test multi processors to see what happens.

However I turned on two processors on a local machine, and TS did start a second orchart process, but I don't have TWSLInk on that machine for testing -- could you send me the setup routines so I can load them on that machine, and if it works, I'll see if the data center can emulate multiple processors.

sectorbets
Posts: 92
Joined: Wed Apr 26, 2017 12:41 pm

Re: Multiple strategies

Post by sectorbets »

I read more about how TS assigns charts to processors, and it is a round robin allocation -- chart 1 goes to processor 1, chart 2 goes to processor 2, chart 3 goes to processor 1, and so forth until all the charts are assigned. I might be able to trick it by manually loading the charts -- I will never have more than a dozen active charts and the same charts are active all day, but if not, I may have to give up.

I was thinking maybe I could test for which socket is next in the round robin and take action based on that -- are you able to read the active socket ??

Thank you
Rick

board_admin
Site Admin
Posts: 244
Joined: Mon Apr 24, 2017 3:24 pm

Re: Multiple strategies

Post by board_admin »

No, TWSLink has no such function. The problem is the TS, not TWSLink.
My advice: move to MultiCharts.

sectorbets
Posts: 92
Joined: Wed Apr 26, 2017 12:41 pm

Re: Multiple strategies

Post by sectorbets »

Where can I find a list of exchanges to be used in the Register_Contract statement??

Thank you
Rick

board_admin
Site Admin
Posts: 244
Joined: Mon Apr 24, 2017 3:24 pm

Re: Multiple strategies

Post by board_admin »

There is no such list. Just use the exchanges possible in TWS

sectorbets
Posts: 92
Joined: Wed Apr 26, 2017 12:41 pm

Re: Multiple strategies

Post by sectorbets »

OK -- we are back to the simple stuff -- I will tackle the multi processor case after everything is running.

It its simplest mode, I want to run a single desktop with three work spaces open, and each work space has its own script.

Do I run Connection = CONNECT("",7498,2,500) in each work space with a different client ID (2 and then 3 and then 4) or do I do something different. We have proven that only one copy of TWSLink has been loaded

board_admin
Site Admin
Posts: 244
Joined: Mon Apr 24, 2017 3:24 pm

Re: Multiple strategies

Post by board_admin »

I you are sure that all those workspaces are loaded in one process,
so TWSLink is loaded only once, then just do the same call with same parameters in each script.

If you call CONNECT("",7498,2,500)
and then
CONNECT("",7498,3,500)
Then TWSLink will disconnect and reconnect with clientid=3. So makes no sense.
Just call
CONNECT("",port,clientid,500)
i each script.

Please mind this relation:
process 1 ---- 1 TWSLink 1 ---- 1 IB

sectorbets
Posts: 92
Joined: Wed Apr 26, 2017 12:41 pm

Re: Multiple strategies

Post by sectorbets »

Everything seems to be working fine -- thanks for all your help. I will run as is for a couple of weeks, and assuming no problems, I will try working with two processors to see what happens.

Rick

board_admin
Site Admin
Posts: 244
Joined: Mon Apr 24, 2017 3:24 pm

Re: Multiple strategies

Post by board_admin »

Thank you for feedback. Always appreciated.

Post Reply