Example #1
0
        private static void ReportGroupByTradeStartTime(Report report, BestTradeTime bestTradeTime)
        {
            var dict = new Dictionary <int, List <Tuple <int[], int[]> > >();

            foreach (var t in bestTradeTime.Calculate())
            {
                int tradeStartTime = t.Item1[2];
                if (!dict.ContainsKey(tradeStartTime))
                {
                    dict[tradeStartTime] = new List <Tuple <int[], int[]> >();
                }
                dict[tradeStartTime].Add(t);
            }
            var list = new List <Tuple <int[], int[]> >();

            foreach (var tuples in dict.Values)
            {
                list.Add(tuples.OrderByDescending(t => bestTradeTime.Comparator(t.Item2)).First());
            }
            foreach (var t in list.OrderByDescending(t => bestTradeTime.Comparator(t.Item2)))
            {
                foreach (var time in t.Item1)
                {
                    report.Write(bestTradeTime.HMString(time));
                }
                foreach (var c in t.Item2)
                {
                    report.Write(c);
                }
                report.WriteLine();
            }
        }
Example #2
0
 private void 日時ベスト夏時間5年_Click(object sender, EventArgs e)
 {
     RunTask(sender, (Report report) => {
         report.Version         = 6;
         report.IsForceOverride = true;
         report.Comment         = "冬時間";
         report.SetHeader("start", "end", "start", "end", "↑↑", "↑↓", "↓↑", "↓↓");
         var bestTradeTime = new BestTradeTime(GetM30Candles(new TimeSpan(365 * 5, 0, 0, 0)))
         {
             IsSummerTime = true
         };
         foreach (var t in bestTradeTime.Calculate(100))
         {
             foreach (var time in t.Item1)
             {
                 report.Write(bestTradeTime.HMString(time));
             }
             foreach (var c in t.Item2)
             {
                 report.Write(c);
             }
             report.WriteLine();
         }
     });
 }
Example #3
0
        private static void ReportGroupByTradeStartAndEndTime(Report report, BestTradeTime bestTradeTime)
        {
            var dict = new Dictionary <int[], List <Tuple <int[], int[]> > >();

            foreach (var t in bestTradeTime.Calculate())
            {
                if (bestTradeTime.Comparator(t.Item2) < 5500)
                {
                    continue;
                }
                int   tradeStartTime = t.Item1[2];
                int   tradeEndTime   = t.Item1[3];
                int[] key            = new int[] { tradeStartTime, tradeEndTime };
                if (!dict.ContainsKey(key))
                {
                    dict[key] = new List <Tuple <int[], int[]> >();
                }
                dict[key].Add(t);
            }
            var list = new List <Tuple <int[], int[]> >();

            foreach (var tuples in dict.Values)
            {
                int[] pre = null;
                foreach (var t in tuples.OrderByDescending(t => bestTradeTime.Comparator(t.Item2)))
                {
                    if (pre != null)
                    {
                        if (IsIntersect(pre, t.Item1))
                        {
                            continue;
                        }
                    }
                    pre = t.Item1;
                    list.Add(t);
                }
            }

            foreach (var t in list.OrderByDescending(t => bestTradeTime.Comparator(t.Item2)).Take(10000))
            {
                foreach (var time in t.Item1)
                {
                    report.Write(bestTradeTime.HMString(time));
                }
                foreach (var c in t.Item2)
                {
                    report.Write(c);
                }
                report.WriteLine();
            }
        }
Example #4
0
 private void 日時上下ベスト(object sender, EventArgs e)
 {
     RunTask(sender, (Report report) => {
         report.Version         = 1;
         report.IsForceOverride = true;
         report.Comment         = "";
         report.SetHeader("start", "end", "start", "end", "↑↑", "↑↓", "↓↑", "↓↓");
         BestTradeTime bestTradeTime = new BestTradeTime(new CandlesticksReader().Read(DATA_PATH + @"\m30-5y.csv"));
         bestTradeTime.Comparator    = f => f[1] - f[0];
         foreach (var t in bestTradeTime.Calculate(100))
         {
             foreach (var time in t.Item1)
             {
                 report.Write(bestTradeTime.HMString(time));
             }
             foreach (var c in t.Item2)
             {
                 report.Write(c);
             }
             report.WriteLine();
         }
     });
 }
Example #5
0
 private void 日時ベスト通年複合5年10分足_Click(object sender, EventArgs e)
 {
     RunTask(sender, (Report report) => {
         report.Version         = 4;
         report.IsForceOverride = true;
         report.Comment         = "USDJPY_0610_0710_夏時間_下落";
         report.SetHeader("start", "end", "start", "end", "↑↑↑", "↑↑↓", "↑↓↑", "↑↓↓", "↓↑↑", "↓↑↓", "↓↓↑", "↓↓↓", "rate");
         var bestTradeTime = new BestTradeTime(GetM10Candles(new TimeSpan(365 * 5, 0, 0, 0)))
         {
             Granularity  = new TimeSpan(0, 10, 0),
             IsSummerTime = true
         };
         List <Tuple <int[], int[], float> > list = new List <Tuple <int[], int[], float> >();
         foreach (var t in bestTradeTime.CalculateDoubleCheckRange(new TimeSpan(6, 10, 0), new TimeSpan(7, 10, 0)))
         {
             var p = GetDoubleCheckProbability(t.Item2, false);
             if (p < 0.50f)
             {
                 continue;
             }
             list.Add(new Tuple <int[], int[], float>(t.Item1, t.Item2, p));
         }
         foreach (var t in list.OrderByDescending(t => t.Item3).Take(1000))
         {
             foreach (var checkTime in t.Item1)
             {
                 report.Write(bestTradeTime.HMString(checkTime));
             }
             foreach (var count in t.Item2)
             {
                 report.Write(count);
             }
             report.WriteLine(t.Item3);
         }
     });
 }