Login Page - Create Account

Support Board


Date/Time: Fri, 03 May 2024 21:09:24 +0000



[Programming Help] - Auto flatten and cancel cell triggered when condition was not true

View Count: 542

[2022-07-16 05:27:05]
dk90 - Posts: 33
Hello. I'm trying to figure out why my position got flattened when the condition I have in flatten and cancel cell J29 could not have possibly been true. Here is what happened last night.

Around 11 pm PST, my system (SC/Teton/VPS/Dorman) got disconnected. This is a problem with ISP connections which is random and very frustrating. At any rate, when my system reconnected with Teton order routing a few seconds later, the log says that my automated spreadsheet system initiated a flatten and cancel action with source: Flatten & Cancel cell.

The condition I have in cell J29 basically says if the loss is greater than a certain threshold amount, flatten and cancel. Until then, my P&L was positive. Even if there was a small loss the threshold loss amount is very large. So there is no way that the condition was true for the flatten and cancel cell to be true and initiate the action. A couple of months ago, I actually saw a flatten and cancel initiated by the system during the day and the condition in J29 was not true.

Maybe there is something else going on here when the service disconnects and reconnects. The flatten and cancel action is not always initiated when connections to the routing server are dropped. This has happened a couple of times only while my connections have dropped many times.

I'm going to get rid of the condition in the cell J29 and place a 0 until we figure out why this is happening. I also have cell J88 (flatten at set time) set to false. Will this be sufficient to prevent an unwanted automated flatten and cancel?

Please advise. Thanks.
[2022-07-20 20:17:24]
dk90 - Posts: 33
Can I get a response please? Thanks.
[2022-07-21 01:18:13]
Sawtooth - Posts: 3993
I wonder if the disconnect/reconnect briefly reported a huge difference in the acct balance, so J29 went TRUE.

Maybe you could add a reference to J57 in your J29 formula:
=AND(YourFlattenCondition,J57=1)
[2022-07-21 04:43:42]
dk90 - Posts: 33
That's a good suggestion tomgilb. Will look into it. Thanks.

I would also like to know from SC engineering regarding this issue.
[2022-07-21 07:09:58]
Sierra Chart Engineering - Posts: 104368
Yes if these cells are what is causing the problem:

I'm going to get rid of the condition in the cell J29 and place a 0 until we figure out why this is happening. I also have cell J88 (flatten at set time) set to false. Will this be sufficient to prevent an unwanted automated flatten and cancel?

What is the exact formula that you are using for the Flatten and Cancel cell?
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, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2022-07-21 18:24:48]
dk90 - Posts: 33
IF(param1 < param2, 1, 0)

where param1 = Net P&L for the day and param2 = maximum loss

param1 was much, much greater than param2 but the condition was triggered incorrectly in the connect/disconnect event mentioned above.
[2022-07-26 03:50:22]
dk90 - Posts: 33
SC Support,

Why do you think the flatten condition was incorrectly triggered? Thanks.
[2022-08-04 21:25:32]
User35525 - Posts: 180
Just happened to me also. Thanks tomglib for the J57 suggestion. Not to hijack the thread, but here's my formula too if it helps (S3 triggers after 3:25pm. H23<H26 is true if daily Net P&L hits a daily loss limit. J21 is monitored since much depends on it):

=AND($J$57=1,
OR(
$S$3=1,
$H$23<$H$26,

AND($J$84=1,$J$8=0,
OR(
$AD$3>2,
AND(FRACTIME(IF($J$67=1,$J$41,A3))-FRACTIME($J$42) >= 10/86400, FRACTIME(IF($J$67=1,$J$41,A3))-FRACTIME($J$43) >= 10/86400)
)),

AND($J$84=0,$J$8<>0,
FRACTIME(IF($J$67=1,$J$41,A3))-FRACTIME($J$42) >= 10/86400, FRACTIME(IF($J$67=1,$J$41,A3))-FRACTIME($J$43) >= 10/86400
),

$J$21<=0
))

*edit* I've seen my $AD$3 formula go #CREF on occasion for a brief period and will remove that bit from the OR
Date Time Of Last Edit: 2022-08-04 21:44:04

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

Login

Login Page - Create Account