Login Page - Create Account

Support Board


Date/Time: Sat, 23 Nov 2024 02:35:47 +0000



[Programming Help] - CPU Exception when use GetStudyArrayFromChart Data in For loop

View Count: 98

[2024-09-11 10:03:45]
User250096 - Posts: 6
this is the code:

SCFloatArray VWAP;
sc.GetStudyArrayFromChart(2, 1, 1, VWAP);
sc.Subgraph[1].Data[sc.Index] = VWAP[a];
float sumVWAP=0;
for(int i=a;i<=b;i++){
sumdVWAP=sumdVWAP+VWAP[i];
}
sumdVWAP=sumdVWAP/(b-a);
The Arraysize of VWAP is more then 80000,number of a and b is between 30000 and 40000 and b>a。
The loop is used twice in the entire code, CPU Exception happened when the second loop is added. If I change VWAP in sumdVWAP=sumdVWAP+VWAP; to a number,the exception disappers.

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

Login

Login Page - Create Account