Login Page - Create Account

Support Board


Date/Time: Tue, 26 Aug 2025 08:57:07 +0000



[Programming Help] - Strange Code Behavior

View Count: 131

[2025-07-21 09:41:11]
User250096 - Posts: 10
Encountered many inexplicable code behaviors when using the following study:

1.During the first load, the value of sc.Close[sc.Index] is 4.2095, but after recalculation, it changes to 5.6320, which is the correct value. This issue occurs across all charts.
2.The variable dir is passed as an external parameter to the function getSumPL, and its value should remain unchanged (in this case, it should stay as 1). However, it occasionally changes to -1 at certain points, even though there is no code modifying it within the function.At these point, sc.Close[sc.Index] also change into 4.2095.
3.In some cases, when printing sc.Close[sc.Index] twice in rapid succession, the output changes—shifting from the correct value 5.6320 to 4.2095 (observed in Subgraph[4] and Subgraph[5]).

https://www.sierrachart.com/image.php?Image=1753090753713.png
Private File
[2025-07-22 01:24:50]
User250096 - Posts: 10
when I change sc.Close[sc.Index] to sc.Close[sc.ArraySize-1], everything goes right
I find sc,Index goes to 0 at these point, I think is a system bug
[2025-07-22 13:15:29]
Sierra_Chart Engineering - Posts: 20734
There definitively is no bug:
, I think is a system bug

This page may be helpful:
Working with ACSIL Arrays and Understanding Looping

Everything that you are posting is not understandable and is of no value since there is no complete and detailed and surrounding context. The only way in which someone can help you, is to have the source code of the custom study, and to take the time to understand it, and do debugging.

We recommend doing step-by-step debugging:
Step-By-Step ACSIL Debugging
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, use the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2025-07-22 13:15:58

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

Login

Login Page - Create Account