Page 1 of 1

Running TS Script on 2 Seprate Charts Simultaneously

Posted: Fri Jan 07, 2022 4:18 pm
by user108
Hello all,

Can someone had some experience using the TS_SIGNAL script Admin has provided on this board SIMULTANEOUSLY on 2 Charts?

Is there a mod needed on the second script, especially for the section when opening a connection to the TWS? (section below Initialized = 0 etc).

I have tried it on 1 chart and it works well... when I try it on a second chart simultaneously... the ret_int on the SECOND one is ALWAYS 0, whilst for the first one is ALWAYS 3... 3 is good.

Anyone please help in advising how to get 2 scripts going that send their respectove orders to TWS? I have a feeling it is about the connection, but not too familiar here

Thanx

Re: Running TS Script on 2 Seprate Charts Simultaneously

Posted: Mon Jan 10, 2022 4:36 pm
by board_admin
You should be able to attach your scripts to multiple charts.
In each script call connect with same parameters -> IP and port.

connect does nothing when you already connected (e.g. because another signal already did)

Re: Running TS Script on 2 Seprate Charts Simultaneously

Posted: Thu Jan 13, 2022 4:02 pm
by user108
After several days of testing - simply applying the SAME TS_SIGNAL script (with a simple if then else statement to generate an order), when applied to MORE Than one chart on the same workspace, or another workspace, it DOES NOT WORK on the second application.

What the Admin has written is a basic initialization block that blindly executes the order when it initializes (and only does that once).

In real life this is not how it happens...

Any attempt to add real life test code out side the Initialize code does not work...

@Admin - can you please post a separate example that simply incorporates the following condition so we can put it on two charts and check. This would give us a great guidance in real world implementation of different order logics

The order logic here is simply for testing

If C <> C[1] then ...
Begin
uid_order=ibgORDER_SEND_STR(connection_id,conid,0, order_attribute_str,0);
if uid_order > 0 then ret_int=ibgWAIT_FILLED(uid_order,5000);
end;

Thanx

Re: Running TS Script on 2 Seprate Charts Simultaneously

Posted: Wed Jan 19, 2022 8:31 pm
by board_admin
Are you sure your EL condition was fullfilled?
There is no information about the order_attribute_str.

The funciton works, if it is called at all and your parameters are correct, your permissions fine, no margin problems etc.
There is no reason why the function should not work, just because called in a 2nd script.
All plugin functions are thread safe.


Perhaps check the orders logfile.
You can find it below your configuration:

C:\trade-commander.com\ibplugin\configurations\<your_config>\log\api\connection_1\channel_order.log

Examples:
C:\trade-commander.com\ibplugin\configurations\TSTN_MUCT\log\api\connection_1\channel_order.log
C:\trade-commander.com\ibplugin\configurations\default\log\api\connection_1\channel_order.log