Attached Orders in a strategy - OCO Interactive Brokers

Questions about MultiCharts and user contributed studies.
User avatar
syswizard
Posts: 295
Joined: 15 Dec 2012
Has thanked: 16 times
Been thanked: 28 times

Attached Orders in a strategy - OCO Interactive Brokers

Postby syswizard » 26 Dec 2018

I read this thread:
viewtopic.php?f=1&t=50344&p=124220&hili ... rs#p124220
I just want to be sure that one must use the twslink DLL in order to accomplish this.
How will the the strategy know which attached order got triggered and which got cancelled ?
I saw this is the PowerLanguage documentation: "!From Strategy To Broker MP Synchronizer!"
Has anyone used this ?

User avatar
syswizard
Posts: 295
Joined: 15 Dec 2012
Has thanked: 16 times
Been thanked: 28 times

Re: Attached Orders in a strategy - OCO Interactive Brokers

Postby syswizard » 27 Dec 2018

I saw this in the Synchronizer code:

Once Begin
.......
End;
What is the purpose of Once ? Is that for initialization stuff ?

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Attached Orders in a strategy - OCO Interactive Brokers

Postby TJ » 27 Dec 2018

MultiCharts needs to update the Keyword definition. This is not in the Wiki or the PLE.

ONCE (Reserved Word)

Reserved word used to specify that the EL statement or begin-end block that follows will only be executed once.

Syntax
ONCE ( [ optional boolean expression ] ) { follow by single statement or statement block }
[begin]
Statement(s)
[end]

Example
Once Value1 = GetAppInfo( aiApplicationType );

Performs the assignment of Value1 a single time. This improves performance instead of using a separate conditional expression (which must be tested on each bar) such as:

if CurrentBar = 1 then Value1 = GetAppInfo( aiApplicationType );

Additional Examples
Once ( MarketPosition = 1 )
Begin
ClearPrintLog;
Print( "Log Header" );
End;

Clears the print log and prints a header the first time the market position equals once.

User avatar
syswizard
Posts: 295
Joined: 15 Dec 2012
Has thanked: 16 times
Been thanked: 28 times

Re: Attached Orders in a strategy - OCO Interactive Brokers

Postby syswizard » 27 Dec 2018

Wow - thanks for that TJ.
So Once can execute statements once conditionally or unconditionally.

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Attached Orders in a strategy - OCO Interactive Brokers

Postby TJ » 27 Dec 2018

Wow - thanks for that TJ.
So Once can execute statements once conditionally or unconditionally.

Yes.


Return to “MultiCharts”