Support Board
Date/Time: Thu, 13 Feb 2025 10:46:21 +0000
[User Discussion] - Message in for loop logged twice
View Count: 524
[2020-12-01 14:59:06] |
kam2001 - Posts: 79 |
Hi, any idea why this message (sc.AddMessageToLog(Buffer,0)) logs twice on each iteartion. Thanks SCDLLName("Demo Kustom") void PassingSCStrutureExampleFunction(SCStudyInterfaceRef sc) { //The "sc" structure can be used anywhere within this function. } SCSFExport scsf_DemoStudyExample(SCStudyGraphRef sc) { if (sc.SetDefaults) { // sc.MaintainAdditionalChartDataArrays = 1; sc.GraphName = "Example Study"; sc.StudyDescription = "This function is an example of how to calculate (close - previous close) * 10."; sc.AutoLoop = 0; // true sc.FreeDLL = 0; sc.Subgraph[0].Name = "Demo"; sc.Subgraph[0].PrimaryColor = RGB(255, 0, 0); // RED return; } sc.DataStartIndex = 0; int MyInt = 50; float MyFloat = 2.5f; SCString Buffer; // Calling this method here so we can log messages by passing 'sc' as parameter PassingSCStrutureExampleFunction(sc); // Data processing if(sc.GetBarHasClosedStatus(sc.Index)==BHCS_BAR_HAS_NOT_CLOSED) { return;//do not do any processing if the bar at the current index has not closed } Buffer.Format("My integer is %d. My float is: %f", sc.UpdateStartIndex, sc.ArraySize); for (int Index = sc.UpdateStartIndex; Index < sc.ArraySize; Index++) { sc.AddMessageToLog(Buffer,0); } } |
To post a message in this thread, you need to log in with your Sierra Chart account: