コード例 #1
0
ファイル: FTR.cs プロジェクト: joniup/Alveo_Indicators
            internal void Init(Bar b)

            {
                ea.Print("MACD2 Init.");
                counter = 0;

                priceClose = (double)b.Close;
                priceOpen  = (double)b.Open;
                priceAvg   = (priceClose + priceOpen) / 2;
                FTR_ALMA.Init(priceAvg);
                FTR.Init(b);

                ftr          = 0;
                ftr_alma     = 0;
                ftrisRising  = false;
                ftrisFalling = false;
                trendDir     = 0;
                prevTrendDir = 0;
                prevState    = 0;
                trendChanged = false;
                stateChanged = false;
                ftr_low      = false;
            }
コード例 #2
0
ファイル: FISHER_X.cs プロジェクト: joniup/Alveo_Indicators
            internal void Init(Bar theBar)

            {
                ea.Print("FISHER Init.");
                counter = 0;

                // initialise Stoch variables
                priceClose        = (double)theBar.Close;
                priceHigh         = (double)theBar.High;
                priceLow          = (double)theBar.Low;
                thePrice          = (priceClose + priceHigh) / 2;
                highestValue_Prev = 0;
                lowestValue_Prev  = 0;
                prevStochastic    = 0;

                RMSFast_Upper.Init(0);
                RMSFast_Lower.Init(0);
                RMSFast.Init(0);
                SIGNAL.Init(0);

                Qprices.Clear();
                for (int i = 0; i < IndicatorPeriod; i++)
                {
                    Qprices.Enqueue(thePrice);
                }

                // initialise 2-Pole Price Super Smoother Variables
                a1 = Math.Exp(-1.414 * 3.1459 / SuperSmootherPeriod);
                b1 = 2 * a1 * Math.Cos(Math.PI * (1.414 * 180 / SuperSmootherPeriod) / 180.0);
                c2 = b1;
                c3 = -a1 * a1;
                c1 = 1 - c2 - c3;

                thePriceSmooth       = 0;
                thePriceSmooth_Prev1 = 0;
                thePriceSmooth_Prev2 = 0;
                thePriceSmooth_Prev3 = 0;
                HPSmooth             = 0;
                HPSmooth_Prev1       = 0;
                HPSmooth_Prev2       = 0;
                HPSmooth_Prev3       = 0;

                // initialise 3-Pole Stoch Super Smoother Variables
                a1_Stoch          = Math.Exp(-3.1459 / SuperSmootherPeriod_Stoch);
                b1_Stoch          = 2 * a1_Stoch * Math.Cos(Math.PI * (1.738 * 180 / SuperSmootherPeriod_Stoch) / 180.0);
                c1_Stoch          = a1_Stoch * a1_Stoch;
                coef2_Stoch       = b1_Stoch + c1_Stoch;
                coef3_Stoch       = -(c1_Stoch + b1_Stoch * c1_Stoch);
                coef4_Stoch       = c1_Stoch * c1_Stoch;
                coef1_Stoch       = 1 - coef2_Stoch - coef3_Stoch - coef4_Stoch;
                StochSmooth       = 0;
                StochSmooth_Prev1 = 0;
                StochSmooth_Prev2 = 0;
                StochSmooth_Prev3 = 0;

                // initialise HP Filter
                alpha1         = (Math.Cos(Math.PI * (0.707 * 360 / (HPPeriod)) / 180.0) + Math.Sin(Math.PI * (0.707 * 360 / (HPPeriod)) / 180.0) - 1) / (Math.Cos(Math.PI * (0.707 * 360 / (HPPeriod)) / 180.0));
                HP             = 0;
                HP_Prev1       = 0;
                HP_Prev2       = 0;
                thePrice_Prev1 = 0;
                thePrice_Prev2 = 0;

                // initialise Bandpass filter
                //beta1 = (Math.Cos(Math.PI * (360 / (IndicatorPeriod)) / 180.0));
                //gamma1 = 1 / (Math.Cos(Math.PI * (360 * BandWidth / (IndicatorPeriod)) / 180.0));
                //alpha2 = gamma1 - Math.Sqrt(gamma1 * gamma1) - 1;

                rms       = 0;
                rms_upper = 0;
                rms_lower = 0;
                signal    = 0;
            }