/// <summary> /// Action to be executd for calculating indicator /// </summary> /// <returns>for future usage. Must be ignored at this time.</returns> protected override bool TrueAction() { // Validate int iSize = _chartPanel._chartX.RecordCount; if (iSize == 0) { return(false); } if (ParamInt(1) < 1 || ParamInt(1) > iSize / 2) { ProcessError("Invalid Periods for indicator " + FullName, IndicatorErrorType.ShowErrorMessage); return(false); } // Get the data Field pSource = SeriesToField("Source", ParamStr(0), iSize); if (!EnsureField(pSource, ParamStr(0))) { return(false); } // Calculate the indicator Oscillator ta = new Oscillator(); Recordset pInd = ta.CenterOfGravity(pSource, ParamInt(1), FullName); // Output the indicator values Clear(); for (int n = 0; n < iSize; ++n) { AppendValue(DM.TS(n), n < ParamInt(1) + 1 ? null : pInd.Value(FullName, n + 1)); } return(_calculateResult = PostCalculate()); }