Esempio n. 1
0
        public List <ChartPointsPredition> ExtractTestContinuous(List <ChartPointsPredition> LCPsPAll)
        {
            List <ChartPointsPredition> LCPsPExtracted = new List <ChartPointsPredition>();

            int iDeepMax = 1;

            for (int i = iDeepMax + 1; i < LCPsPAll.Count; i++)
            {
                int  iDeep = -1;
                bool bPass = true;

                while (++iDeep < iDeepMax && bPass != false)
                {
                    ChartPointsPredition CPsPPrevious = LCPsPAll[i - 1 - iDeep];
                    ChartPointsPredition CPsPNow      = LCPsPAll[i - iDeep];

                    double dTimeSpread = (CPsPNow.DTOriginal - CPsPPrevious.DTOriginal).TotalMinutes;
                    int    iTFMinutes  = ABBREVIATIONS.ToMinutes(CPsPNow.TimeFrame);

                    if (CPsPNow.Type != CPsPPrevious.Type || dTimeSpread > iTFMinutes)//CPsPNow.Ahead)
                    {
                        bPass = false;
                    }
                }

                if (bPass)
                {
                    LCPsPExtracted.Add(LCPsPAll[i]);
                }
            }

            return(LCPsPExtracted);
        }
Esempio n. 2
0
        public List <ChartPointsPredition> ExtractTypeTest(List <ChartPointsPredition> LCPsPAll, ChartPointsPredition CPsPOriginal, bool reversed)
        {
            List <ChartPointsPredition> LCPsPExtracted = new List <ChartPointsPredition>();

            if (CPsPOriginal.Type == ChartPointsPredition.Kind.Uncertain || CPsPOriginal.Type == ChartPointsPredition.Kind.Average)
            {
                return(LCPsPExtracted);
            }

            for (int i = 0; i < LCPsPAll.Count; i++)
            {
                ChartPointsPredition CPsP = LCPsPAll[i];

                if (CPsP.Type == ChartPointsPredition.Kind.Uncertain || CPsP.Type == ChartPointsPredition.Kind.Average)
                {
                    continue;
                }


                if (!reversed && CPsPOriginal.Type == CPsP.Type)
                {
                    LCPsPExtracted.Add(CPsP);
                }
                else if (reversed && CPsPOriginal.Type != CPsP.Type)
                {
                    LCPsPExtracted.Add(CPsP);
                }
            }

            return(LCPsPExtracted);
        }
Esempio n. 3
0
        public void Save_ChartPointsPrediction(List <ChartPointsPredition> LCPsPrediction)
        {
            ChartPointsPredition CPsPSource = LCPsPrediction.First(CPsP => CPsP != null && CPsP.Analised);
            string TimeFrame = ABBREVIATION.ToString(CPsPSource.TimeFrame);

            string product = CPsPSource.Product.Replace("/", "-");
            int    deep    = CPsPSource.Deep;
            int    ahead   = CPsPSource.Ahead;

            List <AsmodatSerialization.DataBase_ChartPointsPrediction> LASDB_CPsPredictions = new List <DataBase_ChartPointsPrediction>();


            foreach (ChartPointsPredition CPsPrediction in LCPsPrediction)
            {
                LASDB_CPsPredictions.Add(CPsPrediction.ToDataBase());
            }

            string directory = Directory_ChartPointsPrediction + TimeFrame + @"\" + CPsPSource.Deep + "+" + CPsPSource.Ahead + @"\";
            string PATCH     = directory + product + Extention_ChartPointsPrediction;

            if (!Directory.Exists(directory))
            {
                Directory.CreateDirectory(directory);
            }
            this.Delete_ChartPointsPrediction(product, TimeFrame, deep, ahead);

            AsmodatSerialization.Operations.Save <List <AsmodatSerialization.DataBase_ChartPointsPrediction> >(LASDB_CPsPredictions, PATCH);
        }
Esempio n. 4
0
        public List <double[]> ExtractParameters(List <ChartPointsPredition> LCPsPAll, ChartPointsPredition CPsPOriginal, bool strikes, bool reversed)
        {
            List <double[]> LDAParams = new List <double[]>();
            string          sID       = CPsPOriginal.ID;

            if (CPsPOriginal.Type == ChartPointsPredition.Kind.Uncertain || CPsPOriginal.Type == ChartPointsPredition.Kind.Average)
            {
                return(LDAParams);
            }

            for (int i = 0; i < LCPsPAll.Count; i++)
            {
                ChartPointsPredition CPsP = LCPsPAll[i];
                if (CPsP.ID == sID || CPsP.Type == ChartPointsPredition.Kind.Uncertain || CPsP.Type == ChartPointsPredition.Kind.Average || strikes != CPsP.Strike)
                {
                    continue;
                }

                if (reversed && CPsP.Type != CPsPOriginal.Type)
                {
                    LDAParams.Add(CPsP.Parameters);
                }
                else if (!reversed && CPsP.Type == CPsPOriginal.Type)
                {
                    LDAParams.Add(CPsP.Parameters);
                }
            }

            return(LDAParams);
        }
Esempio n. 5
0
        private void CheckupContinuity(ref ChartPointsPredition CPsP, int position)
        {
            CPsP.Continuity = 0;
            int iSeconds = (ABBREVIATIONS.ToMinutes(CPsP.TimeFrame) * 60);



            for (int i = position - 1; i >= 0; i--)
            {
                ChartPointsPredition CPsPPrevious = DATA[CPsP.Product][i];
                if (CPsPPrevious.Type == ChartPointsPredition.Kind.Uncertain)
                {
                    break;
                }

                double dSecondsDifference        = (CPsP.DTOriginal - CPsPPrevious.DTOriginal).TotalSeconds;
                double dSecondsDifferenceAllowed = (iSeconds * (position - i)) + 6;

                if (dSecondsDifference > dSecondsDifferenceAllowed)
                {
                    break;
                }
                else
                {
                    ++CPsP.Continuity;
                }

                if (CPsP.Continuity >= CPsP.Deep)
                {
                    break;
                }
            }
        }
Esempio n. 6
0
        public void TestUnknownPosition(ref ChartPointsPredition CPsPOriginal)
        {
            string product = CPsPOriginal.Product;
            ChartPointsPredition CPsPToAnalise = CPsPOriginal;

            this.Checkup(ref CPsPOriginal);
        }
Esempio n. 7
0
        private void CheckupContinuityTendencyChange(ref ChartPointsPredition CPsP, int position)
        {
            CPsP.ContinuityTendencyChange = 0;
            double dPreviousTendency = CPsP.Tendency;

            for (int i = position - 1; i >= (position - CPsP.Continuity); i--)
            {
                ChartPointsPredition CPsPPrevious = DATA[CPsP.Product][i];

                if (CPsP.Type == ChartPointsPredition.Kind.Up)
                {
                    if (CPsPPrevious.Tendency < dPreviousTendency)
                    {
                        ++CPsP.ContinuityTendencyChange;
                        dPreviousTendency = CPsPPrevious.Tendency;
                    }
                    else
                    {
                        break;
                    }
                }
                else if (CPsP.Type == ChartPointsPredition.Kind.Down)
                {
                    if (CPsPPrevious.Tendency > dPreviousTendency)
                    {
                        ++CPsP.ContinuityTendencyChange;
                        dPreviousTendency = CPsPPrevious.Tendency;
                    }
                    else
                    {
                        break;
                    }
                }
            }
        }
Esempio n. 8
0
        private ChartPointsPredition Predict(TimeFrame TFrame, string product, int deep, int ahead, int position, List <ChartPoint> LCPoints)
        {
            int iDeep  = deep;
            int iAhead = ahead;

            if (position < iDeep)
            {
                return(null);
            }


            int               iDecimals       = int.Parse(OSBlotter.Get(product).DecimalPlaces);
            int               iMinMatches     = 1;
            double            dMinResolution  = 1;
            List <ChartPoint> LCPSub          = LCPoints.GetRange(0, position);
            List <ChartPoint> LCPSubSpecified = LCPoints.GetRange(position - iDeep, iDeep);
            //List<ChartPoint> LCPSubPredicted = LCPoints.GetRange(position, iAhead);//TODO comment



            ChartPointsPredition CPsP = ANALYSIS.PredictNextSpecified(product, LCPSub, LCPSubSpecified, TFrame, iDecimals, iMinMatches, dMinResolution, iAhead, new double[] { 0, 0, 0, 0, 0 });

            CPsP.Prognosis(0);
            CPsP.Position = position;
            return(CPsP);
        }
Esempio n. 9
0
        private void CheckupStrengthFactor(ref ChartPointsPredition CPsP)
        {
            List <ChartPoint> LCPOrigin = ARCHIVE.GetDATA(CPsP.TimeFrame, CPsP.Product, CPsP.Position - CPsP.Deep, CPsP.Deep);
            List <double>     LDOPeak   = (from CP in LCPOrigin select CP.Peak).ToList();
            List <double>     LDOBase   = (from CP in LCPOrigin select CP.Peak).ToList();

            CPsP.SetStrengthFactor(LDOPeak, LDOBase);
        }
Esempio n. 10
0
        private void CheckupTendencyToday(ref ChartPointsPredition CPsP)
        {
            List <ChartPoint> LCPToday = ARCHIVE.GetDATA(CPsP.TimeFrame, CPsP.Product, CPsP.DTOriginal.Date, CPsP.DTOriginal);
            //List<double> LDChanges = (from CP in LCPToday select CP.Change).ToList();

            double dExtremumTodayDistance;

            CPsP.TendencyToday         = ANALYSIS.TendencyLastExtremum(LCPToday, out dExtremumTodayDistance);//ANALYSIS.Tendency(LDChanges, LDChanges.Count);
            CPsP.ExtremumTodayDistance = dExtremumTodayDistance;
        }
Esempio n. 11
0
        private void ExtractChartPoints(List <ChartPointsPredition> LCPsPSet)
        {
            int iLCPsPSCount         = LCPsPSet.Count;
            List <ChartPoint> LCPAll = new List <ChartPoint>();

            for (int i = 0; i < iLCPsPSCount; i++)
            {
                ChartPointsPredition CPsPNow = LCPsPSet[i];
                int iDeep = CPsPNow.Deep;
                LCPAll.AddRange(DLSCPoints[CPsPNow.Product].GetRange(CPsPNow.Position - iDeep, iDeep));
            }
        }
Esempio n. 12
0
        public int DATAFindIndex(ChartPointsPredition CPsP)
        {
            for (int i = DATA[CPsP.Product].Count - 1; i >= 0; i--)
            {
                if (DATA[CPsP.Product][i] == CPsP)
                {
                    return(i);
                }
            }

            return(-1);
        }
Esempio n. 13
0
        public List <ChartPointsPredition> ExtractSimilarityTest(List <ChartPointsPredition> LCPsPAll)
        {
            List <ChartPointsPredition> LCPsPExtracted = new List <ChartPointsPredition>();


            for (int i = 0; i < LCPsPAll.Count; i++)
            {
                ChartPointsPredition CPsPNow = LCPsPAll[i];
                if (CPsPNow.Similarity > 80)// / 2) + 1))
                {
                    LCPsPExtracted.Add(CPsPNow);
                }
            }

            return(LCPsPExtracted);
        }
Esempio n. 14
0
        public List <ChartPointsPredition> ExtractTypeExtremumTendencyTest(List <ChartPointsPredition> LCPsPAll)
        {
            List <ChartPointsPredition> LCPsPExtracted = new List <ChartPointsPredition>();


            for (int i = 0; i < LCPsPAll.Count; i++)
            {
                ChartPointsPredition CPsPNow = LCPsPAll[i];
                if (CPsPNow.ExtremumTodayDistance > ((CPsPNow.Deep)))// / 2) + 1))
                {
                    LCPsPExtracted.Add(CPsPNow);
                }
            }

            return(LCPsPExtracted);
        }
Esempio n. 15
0
        private void StartNext(string product, TimeFrame TFrame, int count, int deep, int ahead, bool AutoSave, int position)
        {
            ChartPointsPredition CPsPNew = this.Predict(TFrame, product, deep, ahead, position, DLSCPoints[product]);

            if (CPsPNew == null)
            {
                return;
            }

            DATA[product].Add(CPsPNew);
            ++iPredictions;
            this.DATASort(product);
            if (AutoSave)
            {
                this.Save(DATA[product]);
            }
        }
Esempio n. 16
0
        public double Resolute(string product, int minResolutions, int index)
        {
            ChartPointsPredition CPsPOriginal = DATA[product][index];

            if (CPsPOriginal == null || CPsPOriginal.Type == ChartPointsPredition.Kind.Uncertain || CPsPOriginal.Type == ChartPointsPredition.Kind.Average || CPsPOriginal.Tendency == 50 || CPsPOriginal.TendencyToday == 50 || CPsPOriginal.TendencyComplementary == 50)
            {
                return(0);
            }

            List <ChartPointsPredition> LCPsPAll = this.ExtractType(DATA[product].GetRange(0, index), CPsPOriginal); //All of type


            //1 - 67%//ExtractTendencyToTendencyComplementary ExtractTendenciesDirectted ExtractTendencyUncertainity
            //1-3 - 67%
            LCPsPAll = this.ExtractTendencyToTendencyComplementary(LCPsPAll, CPsPOriginal);

            //0.87 ratio - ExtractTendencyToTendencyComplementary

            double[] DAParametersOryginal = CPsPOriginal.Parameters;

            List <double[]> LDAPStrikes = this.ExtractParameters(LCPsPAll, CPsPOriginal, true, false);
            List <double[]> LDAPFails   = this.ExtractParameters(LCPsPAll, CPsPOriginal, false, false);

            double dRatio = ((double)LDAPStrikes.Count / LCPsPAll.Count()) * 100;

            if (LDAPStrikes.Count < minResolutions || LDAPFails.Count < minResolutions || dRatio < 25)
            {
                return(0);
            }

            double dSFS = ANALYSIS.SimilarityFactor(LDAPStrikes, DAParametersOryginal);
            double dSFF = ANALYSIS.SimilarityFactor(LDAPFails, DAParametersOryginal);// *((double)LDAPFails.Count() / LCPsPAll.Count());


            if (dSFS > dSFF)
            {
                return(((double)dSFS / dSFF) * 100 * ((double)LDAPStrikes.Count() / LCPsPAll.Count()));
            }
            else
            {
                return(0);
            }
        }
Esempio n. 17
0
        private bool CheckupTest(ref ChartPointsPredition CPsP)//, List<ChartPoint> LCPointsToPredict, double spread)
        {
            if (CPsP.Type == ChartPointsPredition.Kind.Uncertain)
            {
                return(false);
            }

            List <ChartPoint> LCPointsToPredict = DLSCPoints[CPsP.Product].GetRange(CPsP.Position, CPsP.Ahead);


            this.CheckupTendencyToday(ref CPsP);
            // this.CheckupTendencyComplementary(ref CPsP);
            this.CheckupStrengthFactor(ref CPsP);


            bool bStrike = false;

            double dRealTendency = 50;

            if (CPsP.Type == ChartPointsPredition.Kind.Down)
            {
                dRealTendency = ANALYSIS.Tendency(LCPointsToPredict, false);

                if (CPsP.Tendency < 50 && dRealTendency < 50)
                {
                    bStrike = true;
                }
            }
            else if (CPsP.Type == ChartPointsPredition.Kind.Up)
            {
                dRealTendency = ANALYSIS.Tendency(LCPointsToPredict, true);

                if (CPsP.Tendency > 50 && dRealTendency > 50)
                {
                    bStrike = true;
                }
            }

            CPsP.Strike = bStrike;
            //CPsP.Accuracity = Accuracity;
            return(true);
        }
Esempio n. 18
0
        public void TestPosition(string product, double gainMultiplayer, int analiseMultiplayer, int index)
        {
            ChartPointsPredition CPsPToAnalise = DATA[product][index];

            CPsPToAnalise.TestID = 1;
            int position = CPsPToAnalise.Position;

            if (position >= (DLSCPoints[product].Count - CPsPToAnalise.Ahead * analiseMultiplayer))
            {
                return;
            }

            /*Rates RATE = ORBlotter.Get(product);
             * double spread = ANALYSIS.Spread(RATE) * gainMultiplayer; //spread = 0.0003;
             *
             * if (CPsPToAnalise.TestSpread == spread)
             *  return;
             *
             * CPsPToAnalise.TestSpread = spread;*/
            this.CheckupTest(ref CPsPToAnalise);//;, DLSCPoints[product].GetRange(CPsPToAnalise.Position, CPsPToAnalise.Ahead), spread);
        }
Esempio n. 19
0
        private bool Checkup(ref ChartPointsPredition CPsP)
        {
            CPsP.TestID = 2;

            if (CPsP.Type == ChartPointsPredition.Kind.Uncertain)
            {
                return(false);
            }

            //this.CheckupContinuity(ref CPsP, position);
            //this.CheckupContinuityAlternative(ref CPsP, position);
            //this.CheckupContinuityTendencyChange(ref CPsP, position);
            this.CheckupTendencyToday(ref CPsP);
            this.CheckupTendencyComplementary(ref CPsP);
            this.CheckupStrengthFactor(ref CPsP);

            CPsP.Strike     = false;
            CPsP.Accuracity = 0;

            return(true);
        }
Esempio n. 20
0
        public List <ChartPointsPredition> ExtractTestContinuousTendency(List <ChartPointsPredition> LCPsPAll)
        {
            List <ChartPointsPredition> LCPsPExtracted = new List <ChartPointsPredition>();

            int iDeepMax = 6;

            for (int i = iDeepMax + 1; i < LCPsPAll.Count; i++)
            {
                int  iDeep = -1;
                bool bPass = true;

                while (++iDeep < iDeepMax && bPass != false)
                {
                    ChartPointsPredition CPsPPrevious = LCPsPAll[i - 1 - iDeep];
                    ChartPointsPredition CPsPNow      = LCPsPAll[i - iDeep];

                    double dTimeSpread = (CPsPNow.DTOriginal - CPsPPrevious.DTOriginal).TotalMinutes;
                    int    iTFMinutes  = ABBREVIATIONS.ToMinutes(CPsPNow.TimeFrame);


                    if (dTimeSpread > iTFMinutes)
                    {
                        bPass = false;
                    }
                    else
                    if ((CPsPNow.Type == ChartPointsPredition.Kind.Down && CPsPNow.Tendency >= CPsPPrevious.Tendency) ||
                        (CPsPNow.Type == ChartPointsPredition.Kind.Up && CPsPNow.Tendency <= CPsPPrevious.Tendency))
                    {
                        bPass = false;
                    }
                }

                if (bPass)
                {
                    LCPsPExtracted.Add(LCPsPAll[i]);
                }
            }

            return(LCPsPExtracted);
        }
Esempio n. 21
0
        public void ResolutePositionTest(string product, int index)
        {
            ++iCounterTotal;
            ChartPointsPredition CPsPOriginal = DATA[product][index];

            double dResolution = this.ResoluteTest(product, 100, index);



            bool bStike = false;

            if (dResolution > 0)
            {
                bStike = true;
            }

            ++iCounter;



            if (bStike == true && CPsPOriginal.Strike == false)
            {
                ++iFails;
            }
            else if (bStike != CPsPOriginal.Strike)
            {
                ++iFailsNotImportangt;
            }
            else if (bStike == true && CPsPOriginal.Strike == true)
            {
                ++iStrikes;
            }

            if (iCounterTotal == 9000)
            {
                int breakpoint = 0;
                int ii         = breakpoint;
            }
        }
Esempio n. 22
0
        public List <ChartPointsPredition> Select(List <string> LSProducts)
        {
            List <ChartPointsPredition> LCPsPSelected = new List <ChartPointsPredition>();

            for (int i = 0; i < LSProducts.Count; i++)
            {
                string product = LSProducts[i];
                if (!DATA.ContainsKey(product) || DATA[product].Count == 0)
                {
                    continue;
                }

                ChartPointsPredition CPsPOriginal = DATA[product].Last();

                if (!CPsPOriginal.IsActual)
                {
                    continue;
                }

                for (int i2 = 0; i2 < DATA[product].Count; i2++)
                {
                    this.TestPosition(product, 1.25, 1, i2);
                }



                this.TestUnknownPosition(ref CPsPOriginal);

                CPsPOriginal.Resolution = this.Resolute(product, 100, this.DATAFindIndex(CPsPOriginal));

                if (CPsPOriginal.Resolution > 0)
                {
                    LCPsPSelected.Add(CPsPOriginal);
                }
            }

            return(LCPsPSelected);
        }
Esempio n. 23
0
        /// <summary>
        /// Must appear after CheckupContinuity is finished, sets cout of similar alternative types in reference to its original
        /// </summary>
        /// <param name="CPsP">Original ChartPoints Predicion</param>
        /// <param name="position">Position of Original in DATA</param>
        private void CheckupContinuityAlternative(ref ChartPointsPredition CPsP, int position)
        {
            CPsP.ContinuityAlternative = 0;

            List <string> LSOptions   = this.Options(CPsP.Product);
            string        alternative = LSOptions[1];

            int iAShift = iAShift = this.PositionShift(CPsP.Product, alternative, 0);
            int iACount = DATA[alternative].Count;
            int iPCount = DATA[CPsP.Product].Count;

            for (int i = position; i >= (position - CPsP.Continuity); i--)
            {
                if (iACount <= (i + iAShift) || iACount <= i || (i + iAShift) < 0 || i < 0 || (iPCount <= i))
                {
                    break;
                }

                iAShift = this.PositionShift(CPsP.Product, alternative, i);

                if (iACount <= (i + iAShift) || iACount <= i || (i + iAShift) < 0 || i < 0 || (iPCount <= i))
                {
                    break;
                }

                ChartPointsPredition CPsPOrigins     = DATA[CPsP.Product][i];
                ChartPointsPredition CPsPAlternative = DATA[alternative][i + iAShift];

                if (CPsPOrigins.Type != ChartPointsPredition.Kind.Uncertain && CPsPAlternative.Type == CPsPOrigins.Type && CPsPOrigins.DTOriginal == CPsPAlternative.DTOriginal)
                {
                    ++CPsP.ContinuityAlternative;
                }
                else
                {
                    break;
                }
            }
        }
Esempio n. 24
0
        private void CheckupTendencyComplementary(ref ChartPointsPredition CPsP)
        {
            List <ChartPoint> LCPToday = ARCHIVE.GetDATA(CPsP.TimeFrame, CPsP.Product, CPsP.DTOriginal.Date, CPsP.DTOriginal);

            int iPosition = ANALYSIS.ExtremumComplementaryPosition(LCPToday, LCPToday.Count, (double)CPsP.Deep / 2);
            //int iPositionBefore = ANALYSIS.ExtremumComplementaryPosition(LCPToday, iPosition + 1, (double)CPsP.Deep / 2);
            int iShiftCount = LCPToday.Count - iPosition;

            if (iShiftCount <= 0 || iPosition >= LCPToday.Count || iPosition - iShiftCount < 0)
            {
                CPsP.ExtremumConplementaryDistance = -1;
                CPsP.TendencyComplementary         = 50;
                return;
            }
            else
            {
                //List<double> LDChanges = (from CP in LCPToday select CP.Change).ToList(); int iCount = LDChanges.Count - iPosition; CPsP.TendencyComplementary = ANALYSIS.Tendency(LDChanges, iPosition, iCount);

                List <ChartPoint> LDCPRanged       = LCPToday.GetRange(iPosition, iShiftCount);
                List <ChartPoint> LDCPRangedBefore = LCPToday.GetRange(iPosition - iShiftCount, iShiftCount);


                double dTendency       = ANALYSIS.Tendency(LDCPRanged);
                double dTendencyBefore = ANALYSIS.Tendency(LDCPRangedBefore);

                if (dTendency < 50 && dTendencyBefore > 50 || dTendency > 50 && dTendencyBefore < 50)
                {
                    CPsP.ExtremumConplementaryDistance = -1;
                    CPsP.TendencyComplementary         = 50;
                    return;
                }

                CPsP.ExtremumConplementaryDistance = (LDCPRanged.Last().Time - LDCPRanged[0].Time).TotalMinutes;
                CPsP.TendencyComplementary         = (dTendency / dTendencyBefore) * 100;
            }
        }
Esempio n. 25
0
        public List <ChartPointsPredition> ExtractTendencyToTendencyComplementary(List <ChartPointsPredition> LCPsPAll, ChartPointsPredition CPsPOriginal)
        {
            List <ChartPointsPredition> LCPsPExtracted = new List <ChartPointsPredition>();

            if (CPsPOriginal.ExtremumConplementaryDistance == CPsPOriginal.ExtremumTodayDistance || CPsPOriginal.TendencyToday == 50 || CPsPOriginal.ExtremumConplementaryDistance <= 0)
            {
                return(LCPsPExtracted);
            }


            if (CPsPOriginal.Tendency < 50)
            {
                for (int i = 0; i < LCPsPAll.Count; i++)
                {
                    if (LCPsPAll[i].ExtremumConplementaryDistance == LCPsPAll[i].ExtremumTodayDistance || LCPsPAll[i].TendencyToday == 50 || LCPsPAll[i].ExtremumConplementaryDistance <= 0)
                    {
                        continue;
                    }

                    if (LCPsPAll[i].TendencyComplementary > 100)
                    {
                        LCPsPExtracted.Add(LCPsPAll[i]);
                    }
                }
            }
            else if (CPsPOriginal.Tendency > 50)
            {
                for (int i = 0; i < LCPsPAll.Count; i++)
                {
                    if (LCPsPAll[i].ExtremumConplementaryDistance == LCPsPAll[i].ExtremumTodayDistance || LCPsPAll[i].TendencyToday == 50 || LCPsPAll[i].ExtremumConplementaryDistance <= 0)
                    {
                        continue;
                    }

                    if (LCPsPAll[i].TendencyComplementary < 100)
                    {
                        LCPsPExtracted.Add(LCPsPAll[i]);
                    }
                }
            }

            return(LCPsPExtracted);
        }
Esempio n. 26
0
        public List <ChartPointsPredition> ExtractTendenciesDirectted(List <ChartPointsPredition> LCPsPAll, ChartPointsPredition CPsPOriginal)
        {
            List <ChartPointsPredition> LCPsPExtracted = new List <ChartPointsPredition>();

            if (CPsPOriginal.ExtremumTodayDistance == CPsPOriginal.ExtremumConplementaryDistance)
            {
                return(LCPsPExtracted);
            }

            if (CPsPOriginal.TendencyComplementary < 50 && CPsPOriginal.Tendency < 50 && CPsPOriginal.TendencyToday < 50)
            {
                for (int i = 0; i < LCPsPAll.Count; i++)
                {
                    if (LCPsPAll[i].TendencyComplementary < 50 && LCPsPAll[i].Tendency < 50 && LCPsPAll[i].TendencyToday < 50 && LCPsPAll[i].ExtremumTodayDistance != LCPsPAll[i].ExtremumConplementaryDistance)
                    {
                        LCPsPExtracted.Add(LCPsPAll[i]);
                    }
                }
            }
            else if (CPsPOriginal.TendencyComplementary > 50 && CPsPOriginal.Tendency > 50 && CPsPOriginal.TendencyToday > 50)
            {
                for (int i = 0; i < LCPsPAll.Count; i++)
                {
                    if (LCPsPAll[i].TendencyComplementary > 50 && LCPsPAll[i].Tendency > 50 && LCPsPAll[i].TendencyToday > 50 && LCPsPAll[i].ExtremumTodayDistance != LCPsPAll[i].ExtremumConplementaryDistance)
                    {
                        LCPsPExtracted.Add(LCPsPAll[i]);
                    }
                }
            }

            return(LCPsPExtracted);
        }
Esempio n. 27
0
        public List <ChartPointsPredition> ExtractTendencyUncertainity(List <ChartPointsPredition> LCPsPAll, ChartPointsPredition CPsPOriginal)
        {
            List <ChartPointsPredition> LCPsPExtracted = new List <ChartPointsPredition>();

            if (CPsPOriginal.Type == ChartPointsPredition.Kind.Uncertain || CPsPOriginal.Type == ChartPointsPredition.Kind.Average)
            {
                return(LCPsPExtracted);
            }

            for (int i = 0; i < LCPsPAll.Count; i++)
            {
                if (LCPsPAll[i].Tendency != 50 && LCPsPAll[i].TendencyComplementary != 50 && LCPsPAll[i].TendencyToday != 50)
                {
                    LCPsPExtracted.Add(LCPsPAll[i]);
                }
            }

            return(LCPsPExtracted);
        }
Esempio n. 28
0
        public List <ChartPointsPredition> ExtractTendency(List <ChartPointsPredition> LCPsPAll, ChartPointsPredition CPsPOriginal)
        {
            List <ChartPointsPredition> LCPsPExtracted = new List <ChartPointsPredition>();

            if (CPsPOriginal.Tendency < 50)
            {
                for (int i = 0; i < LCPsPAll.Count; i++)
                {
                    if (LCPsPAll[i].Tendency < 50)
                    {
                        LCPsPExtracted.Add(LCPsPAll[i]);
                    }
                }
            }
            else if (CPsPOriginal.Tendency > 50)
            {
                for (int i = 0; i < LCPsPAll.Count; i++)
                {
                    if (LCPsPAll[i].Tendency > 50)
                    {
                        LCPsPExtracted.Add(LCPsPAll[i]);
                    }
                }
            }

            return(LCPsPExtracted);
        }
Esempio n. 29
0
        public List <ChartPointsPredition> ExtractCounterType(List <ChartPointsPredition> LCPsPAll, ChartPointsPredition CPsPOriginal)
        {
            List <ChartPointsPredition> LCPsPExtracted = new List <ChartPointsPredition>();

            if (CPsPOriginal.Type == ChartPointsPredition.Kind.Uncertain || CPsPOriginal.Type == ChartPointsPredition.Kind.Average)
            {
                return(LCPsPExtracted);
            }

            for (int i = 0; i < LCPsPAll.Count; i++)
            {
                if (CPsPOriginal.Type != LCPsPAll[i].Type)
                {
                    LCPsPExtracted.Add(LCPsPAll[i]);
                }
            }

            return(LCPsPExtracted);
        }
Esempio n. 30
0
        public double ResoluteTest(string product, int minResolutions, int index)
        {
            ChartPointsPredition CPsPOriginal = DATA[product][index];

            if (CPsPOriginal.Type == ChartPointsPredition.Kind.Uncertain || CPsPOriginal.Type == ChartPointsPredition.Kind.Average)
            {
                return(0);
            }

            //ExtractTypeExtremumTendencyTest
            List <ChartPointsPredition> LCPsPAll         = this.ExtractTypeTest(DATA[product].GetRange(0, index), CPsPOriginal, false); //All of type
            List <ChartPointsPredition> LCPsPAllReversed = this.ExtractTypeTest(DATA[product].GetRange(0, index), CPsPOriginal, true);  //All of type

            // LCPsPAll = this.ExtractSimilarityTest(LCPsPAll); LCPsPAllReversed = this.ExtractSimilarityTest(LCPsPAllReversed);
            // LCPsPAll = this.ExtractTypeExtremumTendencyTest(LCPsPAll); LCPsPAllReversed = this.ExtractTypeExtremumTendencyTest(LCPsPAllReversed);
            //LCPsPAll = this.ExtractTestContinuous(LCPsPAll); LCPsPAllReversed = this.ExtractTestContinuous(LCPsPAllReversed);
            //LCPsPAll = this.ExtractTestContinuousTendency(LCPsPAll); LCPsPAllReversed = this.ExtractTestContinuousTendency(LCPsPAllReversed);

            double[] DAParametersOryginal = CPsPOriginal.Parameters;

            List <double[]> LDAPStrikes = this.ExtractParameters(LCPsPAll, CPsPOriginal, true, false);
            List <double[]> LDAPFails   = this.ExtractParameters(LCPsPAll, CPsPOriginal, false, false);

            List <double[]> LDAPStrikesReversed = this.ExtractParameters(LCPsPAllReversed, CPsPOriginal, true, true);
            List <double[]> LDAPFailsReversed   = this.ExtractParameters(LCPsPAllReversed, CPsPOriginal, false, true);

            double dRatio         = ((double)LDAPStrikes.Count / LCPsPAll.Count()) * 100;
            double dRatioReversed = ((double)LDAPStrikesReversed.Count / LCPsPAllReversed.Count()) * 100;

            //50.14-50.85 - clear

            if (LDAPStrikesReversed.Count < minResolutions || LDAPFailsReversed.Count < minResolutions)
            {
                return(0);
            }

            if (LDAPStrikes.Count < minResolutions || LDAPFails.Count < minResolutions)
            {
                return(0);
            }

            if (dRatio < 45 || dRatioReversed < 45)
            {
                //throw new Exception("Something is f****d up !");
            }

            for (int i = 0; i < LDAPStrikes.Count; i++)
            {
                if (LDAPStrikes[i] == null)
                {
                    var v = 0;
                    var P = 1 + v;
                }
            }
            for (int i = 0; i < LDAPFails.Count; i++)
            {
                if (LDAPFails[i] == null)
                {
                    var v = 0;
                    var P = 1 + v;
                }
            }

            return(1);

            double dSFS = ANALYSIS.SimilarityFactor(LDAPStrikes, DAParametersOryginal);
            double dSFF = ANALYSIS.SimilarityFactor(LDAPFails, DAParametersOryginal);// *((double)LDAPFails.Count() / LCPsPAll.Count());

            return(1);

            if (dSFS > dSFF)
            {
                return(((double)dSFS / dSFF) * 100 * ((double)LDAPStrikes.Count() / LCPsPAll.Count()));
            }
            else
            {
                return(0);
            }
        }