Support Board
Date/Time: Mon, 03 Mar 2025 22:06:19 +0000
Closing All Open Positions/Order Outside of Allowed Iime Range of System for Trading
View Count: 556
[2021-11-05 05:20:08] |
buggsuperstar - Posts: 33 |
Hello, I have a system that only allows entries from 6:30 to 9 AM CST but leaves any remaining orders left to run till they either hit target/stops or get closed automatically at the end of the day however the latter is not working. From reading the board it seems like the orders are not closing because the end of the pit session is outside the allowed time range for my entries (6:30-9 AM CST). Is there a solution to this yet? Thank you. |
[2021-11-05 13:17:58] |
Sawtooth - Posts: 4179 |
Instead of using J85,J86,J87, use a formula like this in J28...: =AND(J8 = 0, OR(FRACTIME(J41) < TIMEVALUE("06:30:00"), FRACTIME(J41) > TIMEVALUE("09:00:00"))) ...and a formula like this in J29: =FRACTIME(J41) > TIMEVALUE("16:00:00") J8=0 in this J28 formula allows exits outside of the entries window. The J29 formula needs to be a later time than the entries window. Spreadsheet Example Formulas and Usage: Disable Autotrading Outside of Regular Trading Hours |
[2021-11-05 20:21:41] |
buggsuperstar - Posts: 33 |
Hi Tom, why would you the position size have anything to do with this logic. This is now disabling entries when I have 0 position size meaning I would never enter a position.
|
[2021-11-05 21:44:47] |
Sawtooth - Posts: 4179 |
why would the position size have anything to do with this logic?
This example assumes your trades are flat to flat.If J8=0, autotrading is not disabled for entries, but if J8<>0, then entries are disabled but exits can occur all day, until the time in J29. If you are using reversals or scaling in, you'll need to use the second part of this example instead: https://www.sawtoothtrade.com/example-4.html (You can use FRACTIME(J41) instead of J41-INT(J41) in the example.) Date Time Of Last Edit: 2021-11-05 21:50:36
|
[2021-11-06 00:19:59] |
buggsuperstar - Posts: 33 |
I think you're on the right track but autotrading doesn't have a distinction between entries and exits. So it sounds like I need to add individual time condition to my entries and exits? Also I found this in the documentation however it does not appear to be true. However, if this cell is set to TRUE at the same time that a cell like Flatten Position and Cancel Working Orders is set to TRUE, then the Flatten Position and Cancel Working Orders action will still occur and then automated trading will be disabled after that. This paragraph applies to versions 1463 and higher. Spreadsheet Systems, Alerts and Automated Trading: Disable Auto Trading [J28] Sierra chart people this is bug I'm pretty sure. Date Time Of Last Edit: 2021-11-06 00:21:20
|
[2021-11-06 01:52:46] |
Sawtooth - Posts: 4179 |
I think you're on the right track but autotrading doesn't have a distinction between entries and exits.
Technically true, but with the example formulas, you can create the distinction.So it sounds like I need to add individual time condition to my entries and exits?
Not if you want to only take entries from 06:30 to 09:00 and any exits from 06:30 to 16:00.If you are not scaling in or using reversals, use the formulas in post#2. If you are scaling in or using reversals, use the examples in post#4. |
To post a message in this thread, you need to log in with your Sierra Chart account: