Login Page - Create Account

Support Board


Date/Time: Sat, 23 Nov 2024 08:21:24 +0000



[Programming Help] - Flatten position not functioning in LIVE using ACISL

View Count: 86

[2024-11-11 18:32:53]
User626318 - Posts: 13
Hello
I have a custom study written in ACSIL that trades from the code written in C++ .
The Buy and Sell Entries and Exits work fine in Sim and Live.
I am finding the two functions sc.FlattenPosition and sc.FlattenAndCancelAllOrders work fine in sim but do not work in live trading.
I am using the Teton Routing Service and enabled the option Hold Market Order Until Pending Cancel Orders Confirmed.
I am using AMP as the broker and Denali for data.
Do you have any suggestions? I have read all I can on the support boards and the supporting documentation.
Is there a line of code I need before sc.FlattenPosition and sc.FlattenAndCancelAllOrders similar to the structure parameter required by sc.BuyEntry etc?
Thanks
[2024-11-13 08:27:50]
User626318 - Posts: 13
Hi there any suggestions to the above please?
[2024-11-13 08:33:43]
User626318 - Posts: 13
just to reiterate that this works as it should in a simulated environment but in live it is not functioning as it should.Do you have a checklist of settings I could try please?or does this suggest that simulation environment doesnt work?
[2024-11-13 14:04:02]
User626318 - Posts: 13
No thanks to the support here(zero answer)but I have worked out that the code referenced position data.position quantity which in a sim environment is updated instantaneously to a non zero value after a trade entry,however in live there is a slight time lag for the trade to be enetered and the value to be non zero .In this case some code was executed erroneously which caused the problem and was not an issue with settings.I have written this here who potentially could have the same problem.
[2024-11-13 14:40:01]
Sierra_Chart Engineering - Posts: 17145
We apologize for the delay. This had gotten overlooked.

I am finding the two functions sc.FlattenPosition and sc.FlattenAndCancelAllOrders work fine in sim but do not work in live trading.
I am using the Teton Routing Service and enabled the option Hold Market Order Until Pending Cancel Orders Confirmed.
The first thing we were going to say is what is the value returned from these functions. And also check the Trade >> Trade Service Log for any error messages.

Also it is not necessary with Teton order routing to enable this:
Hold Market Order Until Pending Cancel Orders Confirmed.

Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing

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

Login

Login Page - Create Account