コード例 #1
0
        public static void OptimizeNotMain(string toolName, int startStop, int endStop, int stopStep)
        {
            var          repository       = new HistoryRepository(toolName, false);
            var          resultText       = new List <string>();
            const double breakevenPercent = 0.15;
            var          lastTradeTime    = new TimeSpan(15, 45, 00);
            const int    monotoneCount    = 4;
            const int    invertCount      = 3;
            const double stopPercent      = 1;

            //for (double stopPercent = 0.5; stopPercent < 1.6; stopPercent += 0.1)
            //{
            for (int stopLoss = startStop; stopLoss <= endStop; stopLoss += stopStep)
            {
                var strat = new MonotoneExtremumsStrategy(monotoneCount, stopLoss, invertCount, breakevenPercent, lastTradeTime, stopPercent);

                var result = strat.Run(repository.Days);
                result.PrintDepo(@"mono\depo\" + stopLoss + "_" + (int)(stopPercent * 10) + ".txt");

                if (result.DealsCount == 0)
                {
                    continue;
                }

                resultText.Add(stopLoss + " " + stopPercent);
                resultText.Add(result.ToString());
                resultText.Add("");
            }
            //}

            File.WriteAllLines(@"mono\out.txt", resultText);
        }
コード例 #2
0
        public static void RunMonotoneExtremums(string toolName, int stopLoss, int pegTopSize, double breakevenSize)
        {
            var repository = new HistoryRepository(toolName, false);
            var resultText = new List <string>();

            var strat = new MonotoneExtremumsStrategy(5, stopLoss, 3, 0.2);

            var result = strat.Run(repository.Days);

            result.PrintDepo(@"mono\depo\run.txt");

            resultText.Add(result.ToString());
            resultText.Add("");

            File.WriteAllLines(@"mono\out.txt", resultText);
        }
コード例 #3
0
        public static void OptimizeEndTime(string toolName, int stopLoss, int monotoneCount, int invertCount)
        {
            var repository = new HistoryRepository(toolName, false);
            var resultText = new List <string>();

            for (int hours = 12; hours <= 23; ++hours)
            {
                for (int minutes = 0; minutes < 60; minutes += 15)
                {
                    var time  = new TimeSpan(hours, minutes, 0);
                    var strat = new MonotoneExtremumsStrategy(monotoneCount, stopLoss, invertCount, 0.15, time);

                    var result = strat.Run(repository.Days);
                    result.PrintDepo(@"mono\depo\" + hours + "_" + minutes + ".txt");

                    resultText.Add(hours + "_" + minutes);
                    resultText.Add(result.ToString());
                    resultText.Add("");
                }
            }

            File.WriteAllLines(@"mono\out.txt", resultText);
        }