Login Page - Create Account

Support Board


Date/Time: Fri, 03 May 2024 16:44:42 +0000



[Programming Help] - ACSIL: Adding to a Position with OCOs

View Count: 866

[2020-10-22 02:43:08]
ondafringe - Posts: 248
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?
[2020-10-22 17:06:03]
bradh - Posts: 854
The Trade Service log or Message Log should tell you why the order is not placed.

You may also need:

sc.AllowMultipleEntriesInSameDirection = true; // This one defaults to false if not specified

Date Time Of Last Edit: 2020-10-22 17:06:34
[2020-10-23 00:02:30]
ondafringe - Posts: 248
Hey, Brad... Yeah, I had that one set to "true" already. I'm still playing with it.

Thanks...
[2020-10-23 01:16:32]
ondafringe - Posts: 248
According to the Trade Service Log, it indicates that "Allow Multiple Entries In Same Direction" is not enabled. But it is enabled, as indicated in my OP, and as follows:

sc.AllowMultipleEntriesInSameDirection = true;
sc.SupportAttachedOrdersForTrading = true;
sc.AllowEntryWithWorkingOrders = true;
sc.MaximumPositionAllowed = 30;
[2020-10-23 20:49:46]
ondafringe - Posts: 248
I think what's going on is "sc.AllowMultipleEntriesInSameDirection = true" only supports "Scale In"

Time to let it go and move on...
[2020-10-25 18:00:21]
User99735 - Posts: 234
If its not too late, there are these switches relating to scaleIn/scaleOut
sc.SupportTradingScaleIn
sc.SupportTradingScaleOut
[2020-10-25 18:38:39]
ondafringe - Posts: 248
Yes, I am aware of those settings. However, "Scale In" won't work for the reasons I mentioned in my first post.

Thanks for trying to help, though! :)
[2020-10-25 18:45:21]
ondafringe - Posts: 248
This could also be related to using "Attached Orders." Some time back, I was playing around with an SC-provided auto-trading study that supposedly supported reversals, but I could never get it to reverse. Turned out, it only supported reversals if you weren't using "Attached Orders," yet that piece of information wasn't included in the documentation.

AT this point, it no longer matters. If it won't work with "Attached Orders," or it only works with "Scale In," I have no need for it.
Date Time Of Last Edit: 2020-10-25 18:45:52

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account