# Relative Orders now available through API

In response to Bob Svan’s request, relative orders are now available through the signal-entry API. Please see signal entry API documentation to learn more.

Relative orders allow you to specify signals, even without knowing prices in advance.

Examples:

Sell at the the session opening price + 5

Set a stop loss at whatever my opening fill price is - 6

Enter at whatever the real-time quote-feed is at time TT:TT + 2

As usual, I’m counting on C2 developers to report any problems, since the feature has been only minimally tested.

Matthew

Hello Matthew!

1. If I understand well, the profit target part of BTO order become active immediately after the order is filled.

But for EOD system it is necessary to delay profit target order to the next day. Is it possible?

2. It would be nice to have "true relative" price: For instance T * 1.025 or T * 0.95 or so.

Then one can sell an equity at price BuyPrice + 2.5% (SellPrice = T * 1.025)

3. What would be excelent: to carry relative price to the whole OCA group of orders.

Trading rules of my Bellatrix system:

1. Buy first day at a limit price. (No sell order - it is EOD system.)

2. Sell second day, if the first profit target is reached. (The profit target is calculated from BuyPrice.)

3. Sell third day, if the second profit target is reached. (The profit target is also calculated from BuyPrice.)

4. If not sold, sell fourth day on market open.

My attempt of a solution:

What if profittarget part of command would be:

profittarget= TheSameAsIsNow OR ProfitTargetOCAGroup

ProfitTargetOCAGroup = (RelativePrice,TimeSpan;RelativePrice,TimeSpan;…)

RelativePrice = arithmetic expresion with BuyPrice T. If RelativePrice=0, it is market order.

TimeSpan = ParkUntilDateTime[,CancellAtDateTime] or in other words: TimeSpan = ValidFrom[,ValidUntil]

if "ValidUntil" is missing, it is duration=DAY order. Duration=GTC can be (maybe) coded with some far future date (ValidUntil=20990101)

For example:

1. BTO order will be posted on 4/7/2008. (No selling order this day.)

2. Profit target for 4/8/2008 is T + 3%

3. Profit target for 4/9/2008 is T + 4%

4. Sell on market open 4/10/2008

…action=BTO&duration=DAY&profittarget=(T1.03,20080408;T1.04,20080409;0,20080410)

Example #2:

1. BTO order will be posted on 4/7/2008. (No selling order this day.)

2. Profit target for period from 4/8/2008 to 4/9/2008 is T + 3%

4. For day 4/10/2008 rules are: profit target is T + 1% and if not reached, sell on market close

…action=BTO&duration=DAY&profittarget=(T1.03,20080408,20080409;T1.01,200804100930,200804101558;0,200804101559)

The Open function in the signal entry API does not seem to work. When I enter this:

http://www.collective2.com/cgi-perl/signal.mpl?cmd=signal&systemid=xxxxx&pw=yyyyy&instrument=future&action=BTO&quant=1&symbol=@ccu8&&stop=O%2B10&duration=DAY

instead of one limit order that does Opening price+10 ticks, I instead get 2 market orders for CCU8. The same thing happens for stops using O function

??

Okay, Ross. I’ll need to look into this. It may not be until the end of the week until I have the cycles to thoroughly examine the O+ issues you’ve been having.

Thanks. I put the above trade in using different variations and instruments, but I always got the same result. Somehow, use of the O function through the API is not being recognized as the O function when it hits your logic. There may be some small nit preventing this.

and in summary for O function,

pit: RR, PL, PA, AD, SF (possibly other currencies) usually do not work. They often show up much later, such as ready to do the same thing for the following day or whenever.

DJ seems to keep thinking it opens at 9:30 instead of 8:20

I just noticed that your trade window thinks that Rice opens at 10:15 EST. It doesn’t open until 10:30

You might want to check over the opening times of your table that you refer.

This is OEC:x thoughts on trading hours: