Profile Picture

Position order status

Posted By phg 10 Years Ago
Message
phg
Supreme Being (44,545 reputation)Supreme Being (44,545 reputation)Supreme Being (44,545 reputation)Supreme Being (44,545 reputation)Supreme Being (44,545 reputation)Supreme Being (44,545 reputation)Supreme Being (44,545 reputation)Supreme Being (44,545 reputation)Supreme Being (44,545 reputation)
Posted Thursday October 18 2007

Suppose a bought position rises over time such that you would like to establish a trailing stop to sell, but not if there is already some form of a sell-type order pending (from a previously handled trigger). Or vice-versa. I'm trying to figure out how to establish either a SetProfitTarget or a trailing stop, but not if the other is already in force.

Is there status information about outstanding order(s) against a position, given the posID? Perhaps this situation is such that good use could be made of the 'tag' property, to keep track of what order is outstanding? Can more than one order at a time be outstanding, or does submitting an order cause an outstanding order to be canceled?



-Pete

See also Yahoo group about applying RE.

Posted Thursday October 18 2007
You'll probably want to use GetPendingOrdersForPosition.  You can iterate over your open positions and get the outstanding trades that are tacked on to the position to see if there is already something in force.  SetProfitTarget will go through and cancel other orders marked as "profit target" orders and replace your new one.  In other words, it's smart.

phg (10/18/2007)

Suppose a bought position rises over time such that you would like to establish a trailing stop to sell, but not if there is already some form of a sell-type order pending (from a previously handled trigger). Or vice-versa. I'm trying to figure out how to establish either a SetProfitTarget or a trailing stop, but not if the other is already in force.

Is there status information about outstanding order(s) against a position, given the posID? Perhaps this situation is such that good use could be made of the 'tag' property, to keep track of what order is outstanding? Can more than one order at a time be outstanding, or does submitting an order cause an outstanding order to be canceled?

phg
Supreme Being (44,545 reputation)Supreme Being (44,545 reputation)Supreme Being (44,545 reputation)Supreme Being (44,545 reputation)Supreme Being (44,545 reputation)Supreme Being (44,545 reputation)Supreme Being (44,545 reputation)Supreme Being (44,545 reputation)Supreme Being (44,545 reputation)
Posted Thursday October 18 2007
Thanks. Off hand that looks like it means I will find what I want in TradeOrder?

-Pete

See also Yahoo group about applying RE.

Posted Thursday October 18 2007
Yes, and you'll want to examine the TradeType enumeration to determine if it's a stop loss, profit target, etc.
phg
Supreme Being (44,545 reputation)Supreme Being (44,545 reputation)Supreme Being (44,545 reputation)Supreme Being (44,545 reputation)Supreme Being (44,545 reputation)Supreme Being (44,545 reputation)Supreme Being (44,545 reputation)Supreme Being (44,545 reputation)Supreme Being (44,545 reputation)
Posted Monday October 22 2007
It seems the trailing stop is not the sort I'm after. I would like something that works more like the function provided by TWS; my strategy would like to set both the stop value and the trailing value, not percentages. (On SetProfitTarget there is a bool to control this.) Also, there doesn't seem to be a way to set GTC. Setting barsValid might be the way to go, but how would that be set along with hard trailing stop values?

-Pete

See also Yahoo group about applying RE.



Similar Topics


Reading This Topic


2005-2017 © RightEdge Systems