Login Page - Create Account

Support Board


Date/Time: Wed, 12 Mar 2025 21:25:55 +0000



[Programming Help] - [ACSIL] - Array loop being run twice?

View Count: 471

[2022-05-29 16:40:44]
backinblack - Posts: 36
Hi,

Am wondering why the following code prints the entire array more than once (It is printing twice atm and was doing 3 times!) on start up?

[b]#include "sierrachart.h"
#include <array>
using namespace std;

SCDLLName("test_loop")

//This is the basic framework of a study function. Change the name 'TemplateFunction' to what you require.
SCSFExport scsf_test_loop(SCStudyInterfaceRef sc)
{

// Section 1 - Set the configuration variables and defaults
if (sc.SetDefaults)
{
sc.GraphName = "test_loop";
sc.StudyDescription = "test_loop";
sc.AutoLoop = 0;
sc.GraphRegion = 0;

return;
}

for (int Index = sc.UpdateStartIndex; Index < sc.ArraySize; Index++) {
SCString Message1;
Message1.Append("---------- 1 ----------- \n");
Message1.AppendFormat("Index is %i, UpdateStartIndex is %i, ArraySize = %i", Index, sc.UpdateStartIndex, sc.ArraySize);
sc.AddMessageToLog(Message1, 1);

}
}[/b]


Thanks
Date Time Of Last Edit: 2022-05-29 16:41:53

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

Login

Login Page - Create Account