Support Board
Date/Time: Thu, 17 Apr 2025 23:43:56 +0000
Post From: Does anyone know what triggers printing StartDateTimeForLoadingOrderFills to message log?
[2025-04-14 00:42:45] |
drinkcodejava - Posts: 25 |
I'm trying to get clarification on Working with ACSIL Arrays and Understanding Looping: When the Study Function is Called I have a custom study with an if (sc.IsFullRecalculation && sc.Index==sc.ArraySize-1) block that is getting executed twice when I recalculate a chart (Chart >> Recalculate). My understanding of the documentation is that when a study is recalculated, the study is called once for each bar of the chart starting from sc.Index=0 through sc.Index=sc.ArraySize-1. However, when I load the following test study, the study runs for each bar, then starts all over again and runs a second time for each bar. In between runs, I see a message printed to the log about StartDateTimeForLoadingOrderFills. I don't know if perhaps this is related to what the documentation describes as "rebuilding of the internal Trades List", but I cannot find any further documentation on either the message or the internal Trades List. It seems like whatever is triggering this message is also triggering another full recalculation. Can anyone help explain what is going on? Here is the code for the test study, and then the message log output for when I: - First add the study to a chart (20:05:56) - Click OK in the Chart Studies dialog window (20:06:10) - Recalculate the chart (20:06:44) - Reload and Recalculate the chart (20:07:09) Bottom line is I'm trying to figure out how to prevent the second round of full recalculation when a chart is recalculated. Thanks! #include "sierrachart.h"
SCDLLName("Full Recalculation Calls") SCSFExport scsf_FullRecalculationCalls(SCStudyInterfaceRef sc) { SCString msg; if (sc.SetDefaults) { sc.GraphName = "Full Recalculation Calls"; sc.AutoLoop = 1; // 1 = Automatic looping is enabled sc.AddMessageToLog("Set defaults called",0); return; } int& callCount = sc.GetPersistentInt(0); // FullRecalculation occurs when a study (or a collection that includes it) is added or when a chartbook is opened // A study function is called twice after data is loaded; once to set defaults, and once again for FullRecalculation // During FullRecalculation, the study function gets called once for each chart bar if (sc.IsFullRecalculation) { sc.AddMessageToLog("FULL RECALCULATION",0); if (sc.Index == sc.ArraySize-1) { callCount++; msg.Format("Call count: %d", callCount); sc.AddMessageToLog(msg,0); } } } 2025-04-13 20:05:56.304 | Chart: MESM25[M] 1 Min #5 | Study: Custom DLL Study | Set defaults called
2025-04-13 20:06:10.947 | Chart: MESM25[M] 1 Min #5 | Study: Full Recalculation Calls | FULL RECALCULATION | Number times message added: 1566 2025-04-13 20:06:10.950 | Chart: MESM25[M] 1 Min #5 | Study: Full Recalculation Calls | Call count: 1 2025-04-13 20:06:44.725 | Chart: MESM25[M] 1 Min #5 | Study: Full Recalculation Calls | FULL RECALCULATION | Number times message added: 1566 2025-04-13 20:06:44.726 | Chart: MESM25[M] 1 Min #5 | Study: Full Recalculation Calls | Call count: 2 2025-04-13 20:06:45.022 | MESM25[M] 1 Min #5 | StartDateTimeForLoadingOrderFills: 00:00:00 2025-04-13 20:06:45.097 | Chart: MESM25[M] 1 Min #5 | Study: Full Recalculation Calls | FULL RECALCULATION | Number times message added: 1566 2025-04-13 20:06:45.098 | Chart: MESM25[M] 1 Min #5 | Study: Full Recalculation Calls | Call count: 3 2025-04-13 20:07:09.319 | MESM25[M] 1 Min #5 | Reloading chart. 2025-04-13 20:07:09.513 | MESM25[M] 1 Min #5 | StartDateTimeForLoadingOrderFills: 00:00:00 2025-04-13 20:07:09.513 | Chart: MESM25[M] 1 Min #5 | Study: Full Recalculation Calls | FULL RECALCULATION | Number times message added: 1567 2025-04-13 20:07:09.514 | Chart: MESM25[M] 1 Min #5 | Study: Full Recalculation Calls | Call count: 4 2025-04-13 20:07:09.517 | MESM25[M] 1 Min #5 | Chart data loading complete. 2025-04-13 20:07:09.580 | Chart: MESM25[M] 1 Min #5 | Study: Full Recalculation Calls | FULL RECALCULATION | Number times message added: 1567 2025-04-13 20:07:09.581 | Chart: MESM25[M] 1 Min #5 | Study: Full Recalculation Calls | Call count: 5 |