Support Board
Date/Time: Sun, 19 Jan 2025 06:34:05 +0000
Post From: Spreadsheet trading study: canceling an unfilled limit order
[2018-02-21 20:34:17] |
Sawtooth - Posts: 4155 |
Those example formulas are simplistic and assume there is only one entry per direction. If you have multiple entries in the same direction before one occurs in the opposite direction, you need to set it to 0 using an event other than a reference to the opposite direction signal. Without knowing the details of your system, only you can determine what that might be. In P3: =IF(BuyZeroingEvent,0,IF(OR(K3,P4>0),P4+1,P4)) In Q3: =IF(SellZeroingEvent,0,IF(OR(M3,Q4>0),Q4+1,Q4)) The zeroing event needs to return a 1 (TRUE). Here's another simpler way to do it for multiple entries in the same direction: In P3: =IF(K3,1,P4+1) In Q3: =IF(M3,1,Q4+1) This starts the count over at each new entry signal, but it may not return what you want in all situations. |