Login Page - Create Account

Support Board


Date/Time: Tue, 13 May 2025 00:34:10 +0000



Post From: CPU Exception when use GetStudyArrayFromChart Data in For loop

[2024-09-11 10:03:45]
User250096 - Posts: 7
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.