Support Board
Date/Time: Fri, 09 May 2025 18:07:54 +0000
Post From: ACSIL: simple FOR loop , very long reload and recalculate time
[2019-02-26 16:16:50] |
TedMar - Posts: 191 |
Hi, in my Example, try simple FOR loop. BUT this example "reload and recalculate" 26 secunds on 1 Day History and period 5 minutes chart. Whats wrong? SCSFExport scsf_ExampleForCount(SCStudyInterfaceRef sc) { SCSubgraphRef Graph1 = sc.Subgraph[0]; if (sc.SetDefaults) { sc.GraphName = "Example Count 4 Red Bars "; sc.StudyDescription = "Count RED Bars Serries in Manual loop"; sc.AutoLoop = 0; sc.GraphRegion = 0; Graph1.Name = "Graph1"; Graph1.DrawStyle = DRAWSTYLE_ARROW_DOWN; Graph1.LineWidth = 3; Graph1.PrimaryColor = RGB(255, 51, 255); return; } for (int BarIndex = sc.UpdateStartIndex; BarIndex < sc.ArraySize; BarIndex++) //Manual Loop { if (sc.Close[BarIndex] < sc.Open[BarIndex]) // find REDBAR { int REDCount = 1; for (int i = REDCount; sc.Close[BarIndex - (REDCount)] < sc.Open[BarIndex - (REDCount)]; i++) //Count RedBars serie,this loop needs 26s for chart Reload 5m Chart on Intel i5 3,3Mhz { REDCount++; } if (REDCount >= 4) { for (int i = 0; i < REDCount; i++) { Graph1[BarIndex - (i)] = sc.High[BarIndex - (i)]; } } } } } v1879 Date Time Of Last Edit: 2019-02-26 16:22:38
|