Login Page - Create Account

Support Board


Date/Time: Wed, 12 Feb 2025 15:07:35 +0000



Post From: ACSIL: Adding to a Position with OCOs

[2020-10-22 02:43:08]
ondafringe - Posts: 298
Before I spend any more hours on this...

I would like to add to an open position. I am using attached orders. When I add the first position, all works as expected. But when I try to add the second position, it doesn't work. The code processes the order, but the order is never placed even though I have:

sc.AllowMultipleEntriesInSameDirection = true;
sc.SupportAttachedOrdersForTrading = true;
sc.AllowEntryWithWorkingOrders = true;
sc.MaximumPositionAllowed = 30;

This example is what I need to accomplish: The first long position has a 2 point Stop and a 2 point Target. The second long position is added at a higher price and needs to also have a 2 point Stop and 2 point Target but... the new Stop/Target needs to be based on the second entry price. Meaning, along with two open positions at different prices, I would also have two Stops at different prices and two Targets at different prices. And so on... and so on...

According to the docs, using Scale In will NOT place a new set of attached orders. It will simply increase the quantity of the original Stop/Target to match the new open position quantity. That is not what I want.

When I add to positions manually on the DOM, I get exactly what I want, a new set of OCOs for every entry. Surely there must be a way to accomplish this using code.

If I stop using attached orders and manually configure the OCO and place it using code, can I get a new set of OCOs every time I add to a position... or not?