Login Page - Create Account

Support Board


Date/Time: Mon, 20 May 2024 22:35:25 +0000



Post From: Spreadsheet formula incorrectly evaluating true?

[2020-07-16 13:48:37]
j4ytr4der_ - Posts: 918
Not sure what's going on here but maybe someone else can point me to it.

I'm trying to build in various "error detectors" in a spreadsheet, to get me flat if certain things ever happen (which shouldn't happen, so these are "emergency breaks" of sorts).

One of them is that I should never have a naked position, that is a position without working orders around it. Sc doesn't provide (as far as I can tell anyway) a direct way to see if there are entry or exit orders in specific in place, so the best I can do is just assume that an open position, with no working orders, is definitely bad and I better get flat before something blows up on me.

Unfortunately there's some sort of problem with this. It's fairly simple really... this formula is in S8 and is one of a few conditions that inform J29 (Flatten & Cancel), and they all state lock so that if any of them trigger I can see which one(s) did it.

Here is my formula:

=IF(AND(J3 = 0, J84 = FALSE, J8 <> 0), TRUE, S8)

If the Working Orders Quantity is zero, and Working Orders do not exist, and there is currently a position on, this evaluates true and I'm flattened. And it does work, but a little too well which is the problem. It is evaluating true for a split second on initial order entries, so I get filled and am instantly flattened. This doesn't happen on all order entries, not even on a majority. But it will happen several times per day easily.

It looks like there is a split second during order entry, that the initial working orders no longer exist, and new ones are created, and during this instant of time the position is flattened. It happens so fast that I can't see it nor record it (I have video of this happening and all you see is a position fill and then get flat).

Anyone have any ideas on why this happens? Or is there maybe a better way to detect what I'm looking to detect?