Login Page - Create Account

Support Board


Date/Time: Wed, 01 May 2024 21:55:33 +0000



sc.Index off by 1 on candle open on backtest replay

View Count: 567

[2019-08-24 03:04:53]
User806682 - Posts: 10
Hello,

Wondering if this is a bug or expected behavior.

I have a study that will execute an order on the candle open, given that previous candle patterns match certain parameters. This works most of the time. But in rare cases, I find that sc.Index is off by 1, meaning it's not at the correct index for the new candle, while sc.ArraySize has been increased by 1 compared to the previous candle.
This only happens sometimes during backtest replay and only once at the beginning of some candles.

I'm currently handling it by doing this:

if (sc.Index != sc.ArraySize-1) {
  return;
}

Thanks.
[2019-08-24 10:13:50]
Sierra Chart Engineering - Posts: 104368
There certainly is no bug in regards to that.

For a full understanding of how this all works, refer to this page:
Working with ACSIL Arrays and Understanding Looping
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing

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

Login

Login Page - Create Account