Login Page - Create Account

Support Board


Date/Time: Thu, 28 Nov 2024 20:33:08 +0000



[Programming Help] - Behaviour of GetBarHasClosedStatus()

View Count: 352

[2023-04-05 12:36:04]
User333366 - Posts: 10
Hi, I am new to Sierra and I just want to check something rather technical

I understand that each update gets processed and that the system only knows the bar is complete when there is an update in a new bar.

But does that mean that the last update of each bar gets process twice, once with a status of BHCS_BAR_HAS_NOT_CLOSED and then consequently with a status BHCS_BAR_HAS_CLOSED?


// Data processing code
if (sc.GetBarHasClosedStatus(sc.Index) == BHCS_BAR_HAS_NOT_CLOSED)
{
// process update that is not closed yet
}
else
{
// process closed bar
}

[2023-04-06 22:47:04]
ondafringe - Posts: 286
Negative logic is harder to follow. So instead of checking whether the bar has NOT closed, it would be better to check whether the bar HAS closed.

But... using your negative logic, here's my take:

The code within your if-condition will continuously execute until you get one tick of movement after the current bar's time period has expired. At that point, the code within your else-condition will execute one time. Then the code within your if-condition will, again, continuously execute -- starting with the first tick of the new bar -- until your negative-logic if-condition returns false.
Date Time Of Last Edit: 2023-04-07 00:13:05

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

Login

Login Page - Create Account