Login Page - Create Account

Support Board


Date/Time: Wed, 15 May 2024 21:20:58 +0000



[Programming Help] - endlessly growing indicator value

View Count: 489

[2020-11-03 04:57:25]
jomo88 - Posts: 47
My custom indicator keeps growing for the most recent value... but only when futures are being used as the main chart. I only plan to use it during the regular trading hours, so I have the chart setting times to restrict that. When I run my indicator now, the most recent value, which does not need to update (it is night time now), keeps growing! See attached

When I have the index feed IUXX or just a stock like MSFT, the problem does not occur. I can't find whats missing in my code. Anyone experience this?

Thanks
imagegrowingstudy.jpg / V - Attached On 2020-11-03 04:55:49 UTC - Size: 77.78 KB - 185 views
[2020-11-03 15:06:05]
jomo88 - Posts: 47
Just tested, it also happens during regular trading hours when my chart settings have new bars coming in within the selected session times.
[2020-11-06 17:24:41]
jomo88 - Posts: 47
For anyone who might be searching for this later on...

My problem was I was using statements like this... sc.Subgraph[0][BarIndex] += 1.0; For example...

for (int BarIndex = sc.UpdateStartIndex; BarIndex < sc.ArraySize; BarIndex++)
{
if (blahblah > 0)
{
sc.Subgraph[0][BarIndex] += 1.0;
}
}

My solution was to create a temporary holder for sc.Subgraph[0][BarIndex] and add it after the if statements

float temp_sum;
for (int BarIndex = sc.UpdateStartIndex; BarIndex < sc.ArraySize; BarIndex++)
{
if (blahblah > 0)
{
temp_sum += 1.0;
}
sc.Subgraph[0][BarIndex] = temp_sum;
}
Date Time Of Last Edit: 2020-11-06 17:26:16

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

Login

Login Page - Create Account