Page 3 of 3

Re: Multiple strategies

Posted: Wed May 31, 2017 5:26 pm
by board_admin
Do you have both TS desktops running and how many ochart.exe can you see in the taskmanager ?
Thank you

Re: Multiple strategies

Posted: Wed May 31, 2017 5:28 pm
by sectorbets
both TS desktops are running and there is just one orchart.exe

Re: Multiple strategies

Posted: Wed May 31, 2017 5:36 pm
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.

Re: Multiple strategies

Posted: Wed May 31, 2017 5:41 pm
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

Re: Multiple strategies

Posted: Wed May 31, 2017 5:47 pm
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.

Re: Multiple strategies

Posted: Wed May 31, 2017 7:04 pm
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.

Re: Multiple strategies

Posted: Wed May 31, 2017 7:42 pm
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

Re: Multiple strategies

Posted: Thu Jun 01, 2017 9:36 am
by board_admin
No, TWSLink has no such function. The problem is the TS, not TWSLink.
My advice: move to MultiCharts.

Re: Multiple strategies

Posted: Thu Jun 01, 2017 3:22 pm
by sectorbets
Where can I find a list of exchanges to be used in the Register_Contract statement??

Thank you
Rick

Re: Multiple strategies

Posted: Thu Jun 01, 2017 3:33 pm
by board_admin
There is no such list. Just use the exchanges possible in TWS

Re: Multiple strategies

Posted: Thu Jun 01, 2017 6:08 pm
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

Re: Multiple strategies

Posted: Fri Jun 02, 2017 11:56 am
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

Re: Multiple strategies

Posted: Fri Jun 02, 2017 1:53 pm
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

Re: Multiple strategies

Posted: Fri Jun 02, 2017 1:59 pm
by board_admin
Thank you for feedback. Always appreciated.