Support Board
Date/Time: Wed, 29 Jan 2025 05:47:54 +0000
Post From: sc.IsFullRecalculation
[2019-03-02 19:27:44] |
User982736 - Posts: 46 |
I am trying to use code I found from the examples that call IsFullRecalculation function. I found that if I call that code as they did, the 20 period moving average is not returning the correct value. If I comment that call out the moving average is correct. When is it appropriate to use this function and why does the moving average not calculate correctly when using it? // Section 1 - Set the configuration variables and defaults if (sc.SetDefaults) { sc.GraphName = "Trade Test Daily PL"; sc.AutoLoop = 1; //Automatic looping is enabled. return; } // Section 2 - Do data processing if (sc.IsFullRecalculation) return; sc.MovingAverage(sc.BaseDataIn[SC_LAST], sc.Subgraph[1], MOVAVGTYPE_EXPONENTIAL, 20); float MovingAverage = sc.Subgraph[1][sc.Index]; SCString MessageString; MessageString.Format("EMA: %.2f", MovingAverage); sc.AddMessageToLog(MessageString, 0); |