Ejemplo n.º 1
0
        public static BollingerBandsData BollingerBands(int Period, float StDev, double[] Input)
        {
            var bb = new BollingerBandsData();

            int outBegIdx    = 0;
            int outNbElement = 0;

            bb.Upper  = new double[Input.Length];
            bb.Middle = new double[Input.Length];
            bb.Lower  = new double[Input.Length];

            var res = TACore.Bbands(0, Input.Length - 1, Input, Period, StDev, StDev, TACore.MAType.Sma, ref outBegIdx, ref outNbElement, bb.Upper, bb.Middle, bb.Lower);

            bb.Upper  = NormalizeArray(bb.Upper, Period);
            bb.Middle = NormalizeArray(bb.Middle, Period);
            bb.Lower  = NormalizeArray(bb.Lower, Period);

            return(bb);
        }
Ejemplo n.º 2
0
        public static Bbands Bbands(
            int startIdx,
            int endIdx,
            float[] real,
            int timePeriod = 5,
            double nbDevUp = 2.0,
            double nbDevDn = 2.0,
            MAType mAType  = MAType.Sma)
        {
            int outBegIdx    = default(int);
            int outNBElement = default(int);

            double[] outRealUpperBand  = new double[endIdx - startIdx + 1];
            double[] outRealMiddleBand = new double[endIdx - startIdx + 1];
            double[] outRealLowerBand  = new double[endIdx - startIdx + 1];

            var retCode = TACore.Bbands(
                startIdx,
                endIdx,
                real,
                timePeriod,
                nbDevUp,
                nbDevDn,
                mAType,
                ref outBegIdx,
                ref outNBElement,
                outRealUpperBand,
                outRealMiddleBand,
                outRealLowerBand);

            return(new Bbands(
                       retCode,
                       outBegIdx,
                       outNBElement,
                       outRealUpperBand,
                       outRealMiddleBand,
                       outRealLowerBand));
        }