Support Board
Date/Time: Sat, 08 Feb 2025 06:26:08 +0000
[Programming Help] - Spreadsheet System: Flatten Positions at Set Time
View Count: 801
[2020-06-26 02:07:56] |
Marion2025 - Posts: 13 |
Hello, I'm trying to implement a spreadsheet trading system that flattens all positions at a set time, and, does not allow any new trades beyond that time. In my spreadsheet I have the following settings: Allow Trading Only During Time Range (read/write): TRUE Start Time For Allowed Time Range (read/write): 10:31:00 End Time For Allowed Time Range (read/write): 15:49:00 Flatten Positions And Cancel Orders At Set Time (read/write): TRUE Time For Flatten Positions And Cancel Orders (read/write): 15:49:00 The problem is, the system will flatten trades at 15:49:00 but then will still put on a new trade at 15:49:00 that will be held until I reach the allowed start time to possibly exit. I want all trades to flatten at 15:49:00 with no new trades allowed. If I set the flatten time after the allowed end time, the trades are not flattened, as the flatten time is outside the allowed trading time. How do I get this to work as desired? Thank you, Alex |
[2020-06-26 02:42:08] |
Sawtooth - Posts: 4173 |
How do I get this to work as desired?
Use J28/J29 instead of J85-J89, with formulas like these:J28: =AND(J8=0,OR(FRACTIME(J41)<TIMEVALUE("10:31:00"),FRACTIME(J41)>TIMEVALUE("15:45:00"))) J29: =FRACTIME(J41)>=TIMEVALUE("15:49:00") Referencing J8=0 in J28 allows exits after the time window, but disallows entries after the time window, so that J29 can flatten after the time window. Date Time Of Last Edit: 2020-06-26 02:43:04
|
[2020-06-26 04:35:41] |
Marion2025 - Posts: 13 |
Yeah that's what I ended up doing, just annoying I need another formula
|
To post a message in this thread, you need to log in with your Sierra Chart account: