public ParameterdCandidateStrategy(CandidateParameter cp = null, 
            ParameterdCandidateStrategy parent = null, IBestCandidateSelector bestCandidateSelector = null)
        {
            if (cp == null)
            {
                cp = new CandidateParameter("Default");
            }
            this.CandidateParameter = cp;

            if (cp.ClassifierType == null && !TestParameters.EnableExcludeClassifier)
            {
                cp.SymbolCount = 1;
                cp.PeriodCount = 1;
                cp.PeriodTimeCount = 0;
                cp.PrevTimeCount = 0;
            }

            InitClassifierInfos(parent);

            if (TestParameters2.RealTimeMode)
            {
                m_enableDetailLogLevel2 = false;
            }

            m_bestCandidateSelector = bestCandidateSelector;
        }
        public ParameterdCandidateStrategy(CandidateParameter cp = null,
                                           ParameterdCandidateStrategy parent = null, IBestCandidateSelector bestCandidateSelector = null)
        {
            if (cp == null)
            {
                cp = new CandidateParameter("Default");
            }
            this.CandidateParameter = cp;

            if (cp.ClassifierType == null && !TestParameters.EnableExcludeClassifier)
            {
                cp.SymbolCount     = 1;
                cp.PeriodCount     = 1;
                cp.PeriodTimeCount = 0;
                cp.PrevTimeCount   = 0;
            }

            InitClassifierInfos(parent);

            if (TestParameters2.RealTimeMode)
            {
                m_enableDetailLogLevel2 = false;
            }

            m_bestCandidateSelector = bestCandidateSelector;
        }
示例#3
0
        public List<ParameterdCandidateStrategy> AddRealDealCandidates(string symbol, int dealInfoLastWeek, IBestCandidateSelector bcs = null)
        {
            List<ParameterdCandidateStrategy> realDealsCandidates = new List<ParameterdCandidateStrategy>();
            //TestParameters.InitTpsls(20, 10);
            //realDealsCandidates.Add(new RealDealCandidate("1M_10", 1 * 4 * 7 * 24 * 12 * 5, this));
            //realDealsCandidates.Add(new RealDealCandidate("1.5M_10", (int)(1.5 * 4 * 7 * 24 * 12 * 5), this));
            //realDealsCandidates.Add(new RealDealCandidate("2M_10", 2 * 4 * 7 * 24 * 12 * 5, this));

            {
                CandidateParameter cp = new CandidateParameter(symbol);

                int delta = TestParameters.GetTpSlMinDelta(symbol) * TestParameters2.nTpsl;
                cp.InitTpsls(TestParameters2.tpStart, delta, TestParameters2.tpCount, TestParameters2.slStart, delta, TestParameters2.slCount);

                cp.SymbolStart = Array.IndexOf<string>(cp.AllSymbols, symbol);
                cp.SymbolCount = 1;
                cp.PeriodStart = Array.IndexOf<string>(cp.AllPeriods, "M1");
                cp.PeriodCount = 1;

                cp.DealInfoLastMinutes = dealInfoLastWeek * 7 * 24 * 12 * 5;
                cp.Group = 1;

                InitBatchBatch(cp);

                if (cp.ClassifierType == null && !TestParameters.EnableExcludeClassifier)
                {
                    cp.AllIndNames.Clear();
                    cp.AllIndNames2.Clear();
                }
                else
                {
                    cp.DeleteUnusedIndicators();
                    //GenerateBatchEmptyInstance();
                }

                ParameterdCandidateStrategy mainPcs = new ParameterdCandidateStrategy(cp, null, bcs);
                realDealsCandidates.Add(mainPcs);

                //    for (int i = 2; i <= 3; ++i)
                //    {
                //        var cp2 = cp.Clone();
                //        cp2.Name += "_" + i.ToString();
                //        cp2.DealInfoLastMinutes = i * 2 * 4 * 7 * 24 * 12 * 5;
                //        realDealsCandidates.Add(new ParameterdCandidateStrategy(cp2));
                //    }
            }

            {
                //CandidateParameter cp = new CandidateParameter("GBPUSD");
                //cp.InitTpsls(10, 60);
                //cp.SymbolStart = 1;
                //cp.DealInfoLastMinutes = 2 * 4 * 7 * 24 * 12 * 5;
                //cp.Group = 2;
                //ParameterdCandidateStrategy mainPcs = new ParameterdCandidateStrategy(cp);
                //mainPcs.m_bestCandidateSelector = new BestCandidateSelector1(0);
                //realDealsCandidates.Add(mainPcs);

                //    for (int i = 2; i <= 3; ++i)
                //    {
                //        var cp2 = cp.Clone();
                //        cp2.Name += "_" + i.ToString();
                //        cp2.DealInfoLastMinutes = i * 2 * 4 * 7 * 24 * 12 * 5;
                //        realDealsCandidates.Add(new ParameterdCandidateStrategy(cp2));
                //    }
            }

            {
                //CandidateParameter cp = new CandidateParameter("EURGBP");
                //cp.InitTpsls(10, 30);
                //cp.SymbolStart = 6;
                //cp.DealInfoLastMinutes = 6 * 4 * 7 * 24 * 12 * 5;
                //cp.Group = 3;
                //ParameterdCandidateStrategy mainPcs = new ParameterdCandidateStrategy(cp);
                //mainPcs.m_bestCandidateSelector = new BestCandidateSelector1(0);
                //realDealsCandidates.Add(mainPcs);

                //    //    for (int i = 2; i <= 3; ++i)
                //    //    {
                //    //        var cp2 = cp.Clone();
                //    //        cp2.Name += "_" + i.ToString();
                //    //        cp2.DealInfoLastMinutes = i * 2 * 4 * 7 * 24 * 12 * 5;
                //    //        realDealsCandidates.Add(new ParameterdCandidateStrategy(cp2));
                //    //    }
            }

            foreach (var i in realDealsCandidates)
            {
                OutputTestInfoCandidate(i.CandidateParameter);
                WekaUtils.Instance.WriteLog(string.Format("BestCandidateSelector = {0}",
                    i.BestCandidateSelector == null ? "Null" : i.BestCandidateSelector.ToString()));
            }

            return realDealsCandidates;
        }