Support Board
Date/Time: Fri, 24 Jan 2025 11:37:09 +0000
Post From: ACSIL - UDP request for resetting Persistent Variables re sc.SetDefaults
[2019-01-06 14:58:49] |
PeterSt - Posts: 36 |
Hi, Search tells me that this has been asked before but remained unanswered (at least back then) : sc.SetDefaults - resetting from within active ACSIL function Also, I think I can reason out that no normal solution can exist to reset the Persistent Variables. Possibly logical reasons may exist for wanting this in normal circumstances, but it could be circumvented by explicit re-assignment. However, I am talking in the context of the solution in here : ACSIL - DLL cannot be opened for writing | Post: 167742 ... which is about recompiling with external editors (like Visual Studio) and my presented solution for that. Thus, the problem is general and would be in order for any random Study. If there is a ready solution or best approach for this today, then can someone kindly let me know how to approach this ? The problem summarized In order to fully automated reload a changed Study, we can make calls to Sierra by means of the UDP interface. Given last link above utilizes that. Also see here : UDP Interface What I found is that the DLL is (or all are) reloaded all right, but that the Persistent Variables are not reset. Mind you, a situation may well exist that this is even not desired, so I am kind of explicitly not asking for doing this inherently. Instead it should be done on command. Btw, please notice the relation to Global Variables, which possibly need to remain as they are. At this moment I am unsure about this because I am only just starting with ACSIL. Said "possibly" could imply that these too need to be reset with some (call back ?) means. If not clear already, a small example of what I refer to : if (sc.SetDefaults)
{ // Set the configuration and defaults sc.GraphName = "XX02 New Study"; sc.StudyDescription = "XX02 Insert description here."; sc.AutoLoop = 1; // true // During development set this flag to 1, so the DLL can be rebuilt without restarting Sierra Chart. // When development is completed, set it to 0 to improve performance. // sc.FreeDLL = 1; // 06-01-2019,PS, Deprecated (right ?). sc.Subgraph[0].Name = "XX02 Subgraph 1 Name a"; sc.Subgraph[0].PrimaryColor = RGB(255,200,0); // Red 06-01-2019,PS, E.g. this one will never reset. sc.Subgraph[0].DrawStyle = DRAWSTYLE_LINE; // Look in scconstants.h for other draw styles sc.Input[0].Name = "Input 1 Name b"; sc.Input[0].SetInt(20); // Set the default value to 20 sc.Input[0].SetIntLimits(1, 1000); //Optional: Limit the range of this input to 1-1000 return; } I think it will be obvious that at developing a Study, the code in the "one time settings" will need to be adjusted once in a while just the same. And when we can not imply sc.Defaults to True, we will not really be able to re-initizalize the Persistent Variables in a transparent way. Or even not at all (I would not know how to and I also tried all sc. properties and functions of the main If of this). And of course, removing the Study from the Chart and add it again, takes too much time. ;-) A temporary solution looks to be : if (true) //(sc.SetDefaults) // If (true) for new compiled version. Data will never be processed.
{ // Init Code goes here. return; } but it would be an odd two-stage process when we are working on this init code plus it can never combine with real data to be processed (because it never will (and should not) during the if true). Thanks, Peter |