Login Page - Create Account

Support Board


Date/Time: Mon, 21 Apr 2025 17:07:54 +0000



Post From: How to restart / recalc only one specific study on a chart - or do I simulate a restart?

[2025-02-26 18:41:20]
User431178 - Posts: 653
If you switch to manual looping, then something like below would work.
You are substituting 0 for sc.UpdateStartIndex only when you have triggered the recalculation.


auto& sg_1 = sc.Subgraph[0];
auto& sg_2 = sc.Subgraph[0];

// Set the recalc state via menu item or button
// configuredMenuItem would be set when first configuring / initializing the study
const auto recalc = sc.MenuEventID == configuredMenuItem && configuredMenuItem != 0;
const auto updateStartIndex = recalc ? 0 : sc.UpdateStartIndex;

for (auto i = updateStartIndex; i < sc.ArraySize; ++i)
{
  if (recalc)
  {
    sg_1[i] = 0;
    sg_2[i] = 0;
  }
  
  // Various other study code etc
}