Login Page - Create Account

Support Board


Date/Time: Thu, 13 Feb 2025 20:14:49 +0000



Freezing before automated trade entry

View Count: 486

[2020-12-16 14:52:05]
User820318 - Posts: 40
I am running an automated trading system built using ACSIL. The system enters at the close of a candle by placing a stop order. I am running the system via a simulated account using the Denali data feed.

I have been noticing that on bars where a trade will be executed at the close the transition between the close and open of the subsequent candle there is a short freeze - i.e. the transition is not smooth. Alternatively on bars where there is no trade executed at the close the freezing behaviour is not evident and the transition is smooth. Invariably when the freezing happens the trade suffers significant slippage.

Are the SC engineering team aware of such issues? I have an atomic clock syncing app to ensure my system time matches the server time and periodically update time from server so I dont think that is the issue here.

Any ideas on how to resolve would be greatly appreciated.
[2020-12-16 16:14:28]
John - SC Support - Posts: 37940
Within Sierra Chart, the previous bar is not closed until the next trade comes in that opens the next bar. What you are wanting to do is covered in this section of the documentation:
ACSIL Programming Concepts: Determining if Last Chart Bar is Closed
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2020-12-16 16:30:22]
User820318 - Posts: 40
Ok thanks. I am using the below as one of the conditions in my entry logic

sc.GetBarHasClosedStatus() == BHCS_BAR_HAS_CLOSED

However, i was not aware that even in time based bars (like 5 min bar) the new bar doesnt open until the first tick is registered. The delays I am observing tend to be more prevalent when market moves quickly during the transition between bars.

Are you saying the above code is inappropriate for executing orders at the bar close only? The link you sent me to says

When trying to determine if the last chart bar is closed, it is not possible to use the function sc.GetBarHasClosedStatus().

[2020-12-16 16:58:01]
John - SC Support - Posts: 37940
Yes, that is exactly what the documentation in that section states.
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2020-12-16 17:37:44]
User820318 - Posts: 40
What then is the purpose of the

sc.GetBarHasClosedStatus() == BHCS_BAR_HAS_CLOSED

function. There are several examples in the TradingSystem.cpp in the ACS_Source folder that use this precise logic to enter at the close. Has something changed?

It would be greatly appreciated if an example could be given as to how to execute trade logic at the close of a bar using the method given in suggested link (ACSIL Programming Concepts: Determining if Last Chart Bar is Closed). I am sure this is a very common feature of most systems and the examples given in the ACS_Source folder use the
sc.GetBarHasClosedStatus()
command so I'd be surprised if I wasn't the only one a little confused by this information.

Thank you for your patience.
Date Time Of Last Edit: 2020-12-16 17:43:45

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account