Support Board
Date/Time: Thu, 16 Jan 2025 17:08:28 +0000
Post From: Ehlers Roofing filter
[2017-11-09 18:01:55] |
Jezz - Posts: 33 |
One Time Calculations That Do Not Run During Study Updating Just watching the code, I realized that filter coefficients are calculated every updating time. Filter coefficients need to be calculated just once from the period parameter. example from the supersmoother section a1 = exp((-1.414f) * 3.14159f / LPPeriod.GetInt());
b1 = 2 * a1 * cos(1.414f * (180 * 3.14159f / 180) / LPPeriod.GetInt()); c2 = b1; c3 = (-1)*a1*a1; c1 = 1 - c2 - c3; All these values depends only on LPPeriod, so they need to be calculated once after the "period" parameter change is applied. I've tried to move this portion of code to a if section as suggested in ACSIL Programming Concepts: One Time Calculations That Do Not Run During Study Updating without any success. If I try to change the value of period, it doesn't look to affect. if(sc.Index == 0)
{ //Code to run only on study full recalculation .... } Is this the right approach? Any suggestion welcome Thanks |