Support Board
Date/Time: Thu, 16 Jan 2025 13:03:06 +0000
Post From: Market on close orders with automated trading
[2017-10-06 21:30:48] |
Sawtooth - Posts: 4153 |
In addition to the imprecision of DateTime values, there are other considerations: 1) J41 does not necessarily update every second. 2) The Time number format of a cell does not affect the underlying DateTime value. 3) An order at the last second of the day may not execute before the day's close. Ignoring #3, I would use formulas like these, which gives a 2 second window from 16:14:58 to 16:15:00: L3: =AND($J$8>0,$J$41-INT($J$41)>$J$76-INT($J$76)-1/86400,$J$41-INT($J$41)<$J$76-INT($J$76)+1/86400) N3: =AND($J$8<0,$J$41-INT($J$41)>$J$76-INT($J$76)-1/86400,$J$41-INT($J$41)<$J$76-INT($J$76)+1/86400) Here's another way to do it, without referencing J76: L3: =AND($J$8>0,$J$41-INT($J$41)>TIMEVALUE("16:14:58"),$J$41-INT($J$41)<TIMEVALUE("16:15:00")) N3: =AND($J$8<0,$J$41-INT($J$41)>TIMEVALUE("16:14:58"),$J$41-INT($J$41)<TIMEVALUE("16:15:00")) Using the above, it would be easier to adjust the time window, to account for #3, either wider or earlier or both. |