OCO Orders  [SOLVED]

Questions about MultiCharts and user contributed studies.
eegroup
Posts: 78
Joined: 04 Aug 2008
Has thanked: 11 times
Been thanked: 9 times

OCO Orders  [SOLVED]

Postby eegroup » 10 Mar 2016

The MultiCharts Online Help documents the following regarding OCO Order Groups:
One Cancels Other (OCO) orders are the price orders sent in a group. When any of OCO orders is filled or partially filled, the system cancels or reduces size of other orders in this OCO-group.
Questions:

1. If we issue two simultaneous trade entry limit orders (one long trade entry at one price and one short trade entry at a different price) with the intention that whichever trade entry order get filled first, the other order gets cancelled, is there anything special that needs to be coded in our PowerLanguage signal/strategy to ensure that those two orders are processed as an OCO Order Group? We are using the native OCO order processing in the CQG Broker Connection.

2. Does anyone have any coding available that would illustrate the best way to manage and process protection against the market risk of OCO orders as documented in the MultiCharts Online Help:
Please note that in case of high market volatility there may be not enough time to cancel the order and therefore both orders may be filled. Both orders also may be filled in the unlikely event of crash or connection loss.
Many thanks!

tony
Posts: 420
Joined: 14 Jun 2013
Has thanked: 30 times
Been thanked: 81 times
Contact:

Re: OCO Orders

Postby tony » 10 Mar 2016

Add recalclastbar(n) to the start of your script so it will calculate at least every "n" seconds. Then add a conditional statement for the long entry signal "if mp = 0" and do the same for the sell short signal "if MP = 0"

This way assume you have a buy and sell short limit order sitting out there and one fills, MP is no longer 0 and the conditions where it is now false will cause that limit order to cancel.

You need the recalclastar(n) to force a script calculation (in case MP doesn't update quickly from your broker) and thus realize that one of the conditional statements which was true is now false and to therefore cancel the limit order that is still open.

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

Re: OCO Orders

Postby TJ » 10 Mar 2016

EasyLanguage OCO keywords:

SetBreakEven
SetDollarTrailing
SetPercentTrailing
SetProfitTarget
SetStopLoss

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: OCO Orders

Postby Henry MultiСharts » 21 Apr 2016

Hello eegroup,

Please study the following thread: OCO @ MultiCharts FAQ.


Return to “MultiCharts”