Example #1
0
        /// <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 size = _chartPanel._chartX.RecordCount;

            if (size == 0)
            {
                return(false);
            }

            int paramInt1 = ParamInt(1);

            if (paramInt1 < 1 || paramInt1 > size)
            {
                ProcessError("Invalid Periods for indicator " + FullName, IndicatorErrorType.ShowErrorMessage);
                return(false);
            }

            // Get the data
            string paramStr0 = ParamStr(0);
            Field  pHigh     = SeriesToField("High", paramStr0 + ".high", size);

            if (!EnsureField(pHigh, paramStr0 + ".high"))
            {
                return(false);
            }
            Field pLow = SeriesToField("Low", paramStr0 + ".low", size);

            if (!EnsureField(pLow, paramStr0 + ".low"))
            {
                return(false);
            }

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

            pRS.AddField(pHigh);
            pRS.AddField(pLow);

            pNav.Recordset_ = pRS;


            // Calculate the indicator
            Oscillator ta   = new Oscillator();
            Recordset  pInd = ta.FractalChaosOscillator(pNav, pRS, paramInt1, FullName);


            // Output the indicator values
            Clear();

            for (int n = 0; n < size; ++n)
            {
                AppendValue(DM.GetTimeStampByIndex(n), n < paramInt1 ? null : pInd.Value(FullName, n + 1));
            }

            return(_calculateResult = PostCalculate());
        }