コード例 #1
0
        /// <summary>
        /// Action to be executed 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);
            }

            // Get the data
            Field pSource = SeriesToField("Source", ParamStr(0), iSize);

            if (!EnsureField(pSource, ParamStr(0)))
            {
                return(false);
            }

            Navigator pNav = new Navigator();
            Recordset pRS  = new Recordset();

            pRS.AddField(pSource);

            pNav.Recordset_ = pRS;

            // Calculate the indicator
            Oscillator ta   = new Oscillator();
            Recordset  pInd = ta.CoppockCurve(pNav, pSource, FullName);

            // Output the indicator values
            Clear();
            for (int n = 0; n < iSize; ++n)
            {
                AppendValue(DM.TS(n), pInd.Value(FullName, n + 1));
            }

            return(_calculateResult = PostCalculate());
        }