Support Board
Date/Time: Mon, 25 Nov 2024 04:29:08 +0000
[Programming Help] - ACSIL: Flatten Orders & Stop Trading Before Market Close
View Count: 349
[2024-04-08 12:58:08] |
User582682 - Posts: 3 |
I've been reading the forums, and there doesn't seem to be any simple solutions so far. What I am looking to do is the following: - Detect market close times. - Stop trading and flatten positions x amount of time before market close. - Re-enable trading when the market opens back up. I am aware of the solutions here in the Global Management: Global Profit Loss Management: Global Profit/Loss Management The issue is that different instruments may have different closing times. It's not very efficient to have to go and manually edit this for each instrument. Also, what happens if the times get changed and a trader who is prop trading gets their account blown due to being forced to manually inputting the old market times? What I would like to do is somehow write code in ACSIL to auto-detect the market close times (Sierra Charts can't seem to do this). Is it possible to use the data feed at all? Has anyone figured out a way to resolve this? The idea I have is to create a study that you can simply add to a chart. Once added, it can auto-detect the closing times and then flatten positions and stop trading shortly before the market closes. This way it'll be simple for users to add the study to each chart, and it'll automatically do this for the trader. Date Time Of Last Edit: 2024-04-08 12:59:13
|
[2024-04-08 16:36:10] |
ondafringe - Posts: 286 |
As far as I know, it's not possible to auto-detect closing times for different exchanges using ACSIL. You could set up some custom inputs, one for each exchange you trade, along with their respective default closing times. However, you would have to monitor holiday schedules and manually update those closing times as needed. And then your code would have to associate each symbol you trade with a given exchange. Depending on the number of symbols you trade, it may not be worth the effort. |
[2024-04-08 16:50:36] |
User431178 - Posts: 541 |
The issue is that different instruments may have different closing times Just make sure that the times are set correctly in the symbol settings, and that the chart session times are based on those in the symbol settings. No need to continuously edit anything and when was the last time the exchange session times changed? Once that is done, it is very easy, you just need to set your code to exit x seconds/minutes before the session close time (from the chart). There is the holiday issue mentioned in the previous reply, but that is not an insurmountable task either. |
[2024-04-08 17:30:32] |
User582682 - Posts: 3 |
Thank you both for your replies. For now, what I'm doing is taking market segments within certain exchanges and creating a general script for those segments. For example, I'll close agricultural trades and cease trading at 2 pm ET and then reopen again at 6 pm ET. This way, I don't have to write the same script in a ton of different ways. For holidays, I'm simply stopping all trading during these periods. I will flip the trading state during these times to ensure no orders go through and all are flattened. Maybe down the road, I will create scripts that auto-update themselves later in case of any time or holiday changes, but for now, this will do. I just find it shocking that after all these years there still isn't a function to simply pull the market close time. It would certainly cut down on the lines of code I need to write. |
To post a message in this thread, you need to log in with your Sierra Chart account: