API Support Forum
OEC API > API Support > Clarification of Trailing Stop behavior
Author Topic: Clarification of Trailing Stop behavior
(2 messages, Page 1 of 1)
Moderators: VPfau
THarnett81
Posts: 78
Joined: Jan 13, 2011


Posted: Mar 12, 2012 @ 03:55 PM             Msg. 1 of 2
Can you confirm that we are understanding OEC's trailing stop behavior correctly?

In a Trailing Stop, the following fields are the price-related fields that affect its behavior:
  • OrderDraft.Price
  • Reference (via OrderDraft.SetTSData)
  • Delta (via OrderDraft.SetTSData)
The behavior of such values is as follows:
  • OrderDraft.Price = price-level where the trailing behavior begins
  • Reference = trigger price to start trailing logic
  • Delta = Modifier that affects both OD.Price and Reference
Did I get all this right?

We see one problem:
In the docs, it says "Usually reference price is the last trade price, and delta is 0."

Doesn't that potentially create a race condition? What if the last trade price changes in between user-action and OEC-reception?
VictorV
Posts: 746
Joined: May 08, 2007


Posted: Mar 15, 2012 @ 11:23 AM             Msg. 2 of 2
Probably, you understand it slightly incorrectly: Reference and Price are modified when current market price is better than Reference price and difference is greater than Delta. So, the docs describes a situation when you need to start trailing logic immediately.

Modify request is an atomic transaction: it will replace all three fields at once.

Victor Vins
Lead Software Developer