예제 #1
0
        private void StartSIM()
        {
            //Laptop
            //string css = @"Data Source=ALSI-PC\;Initial Catalog=AlsiTrade;Integrated Security=True";

            //PC
            string css = @"Data Source=PIETER-PC\;Initial Catalog=AlsiTrade;Integrated Security=True";


            AlsiUtils.Data_Objects.GlobalObjects.CustomConnectionString = css;


            DateTime s = new DateTime(2012, 12, 1);
            DateTime e = new DateTime(2013, 12, 29);

            var prices = AlsiUtils.DataBase.readDataFromDataBase(AlsiUtils.Data_Objects.GlobalObjects.TimeInterval.Minute_5, AlsiUtils.DataBase.dataTable.MasterMinute, s, e, false);

            AlsiUtils.Strategies.Parameter_SS_RSI p = new AlsiUtils.Strategies.Parameter_SS_RSI();
            p.Close_20   = 15;
            p.Close_80   = 60;
            p.Fast_K     = 3;
            p.Slow_K     = 6;
            p.Slow_D     = 4;
            p.Open_20    = 30;
            p.Open_80    = 50;
            p.StopLoss   = -250;
            p.TakeProfit = 250;


            for (int rsi = (int)rsiStart.Value; rsi <= (int)rsiEnd.Value; rsi += 2)
            {
                rsiLabel.Text = rsi.ToString() + " / " + rsiEnd.Value.ToString();
                for (int ma = (int)maStart.Value; ma <= (int)maEnd.Value; ma += 2)
                {
                    maLabel.Text = ma.ToString() + " / " + maEnd.Value.ToString();
                    for (int ma2 = (int)ma2Start.Value; ma2 <= (int)ma2End.Value; ma2 += 2)
                    {
                        ma2Label.Text = ma2.ToString() + " / " + ma2End.Value.ToString();
                        for (int midL = 40; midL <= 55; midL += 2)
                        {
                            midLLabel.Text = midL.ToString() + " / 55";
                            for (int midS = 35; midS <= 50; midS += 2)
                            {
                                midSlabel.Text = midS.ToString() + " / 50";
                                for (int cL = 50; cL <= 70; cL += 5)
                                {
                                    cLLabel.Text = cL.ToString() + " / 70";
                                    for (int cS = 30; cS <= 50; cS += 5)
                                    {
                                        cSLabel.Text        = cS.ToString() + " / 50";
                                        p.RSI               = rsi;
                                        p.RSI_MA            = ma;
                                        p.RSI_MA2           = ma2;
                                        p.RSI_MidLine_Long  = midL;
                                        p.RSI_MidLine_Short = midS;
                                        p.RSI_CloseLong     = cL;
                                        p.RSI_CloseShort    = cS;
                                        //  Db(Startegy_SSPOP_RSI.SsPopStrategy(p, prices), p);
                                        AlsiUtils.Strategies.Startegy_SSPOP_RSI.SsPopStrategy(p, prices);
                                        Close();
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
예제 #2
0
        private void StartSIM()
        {
            //Laptop
            //string css = @"Data Source=ALSI-PC\;Initial Catalog=AlsiTrade;Integrated Security=True";

            //PC
            string css = @"Data Source=PIETER-PC\;Initial Catalog=AlsiTrade;Integrated Security=True";


            AlsiUtils.Data_Objects.GlobalObjects.CustomConnectionString = css;


            DateTime s = new DateTime(2012, 12, 1);
            DateTime e = new DateTime(2013, 12, 29);

            var prices = AlsiUtils.DataBase.readDataFromDataBase(AlsiUtils.Data_Objects.GlobalObjects.TimeInterval.Minute_5, AlsiUtils.DataBase.dataTable.MasterMinute, s, e, false);

            AlsiUtils.Strategies.Parameter_SS_RSI p = new AlsiUtils.Strategies.Parameter_SS_RSI();
            p.Close_20 = 15;
            p.Close_80 = 60;
            p.Fast_K = 3;
            p.Slow_K = 6;
            p.Slow_D = 4;
            p.Open_20 = 30;
            p.Open_80 = 50;
            p.StopLoss = -250;
            p.TakeProfit = 250;


            for (int rsi = (int)rsiStart.Value; rsi <= (int)rsiEnd.Value; rsi += 2)
            {
                rsiLabel.Text = rsi.ToString() + " / " + rsiEnd.Value.ToString();
                for (int ma = (int)maStart.Value; ma <= (int)maEnd.Value; ma += 2)
                {
                    maLabel.Text = ma.ToString() + " / " + maEnd.Value.ToString();
                    for (int ma2 = (int)ma2Start.Value; ma2 <= (int)ma2End.Value; ma2 += 2)
                    {
                        ma2Label.Text = ma2.ToString() + " / " + ma2End.Value.ToString();
                        for (int midL = 40; midL <= 55; midL += 2)
                        {
                            midLLabel.Text = midL.ToString() + " / 55";
                            for (int midS = 35; midS <= 50; midS += 2)
                            {
                                midSlabel.Text = midS.ToString() + " / 50";
                                for (int cL = 50; cL <= 70; cL += 5)
                                {
                                    cLLabel.Text = cL.ToString() + " / 70";
                                    for (int cS = 30; cS <= 50; cS += 5)
                                    {
                                        cSLabel.Text = cS.ToString() + " / 50";
                                        p.RSI = rsi;
                                        p.RSI_MA = ma;
                                        p.RSI_MA2 = ma2;
                                        p.RSI_MidLine_Long = midL;
                                        p.RSI_MidLine_Short = midS;
                                        p.RSI_CloseLong = cL;
                                        p.RSI_CloseShort = cS;
                                      //  Db(Startegy_SSPOP_RSI.SsPopStrategy(p, prices), p);
                                        AlsiUtils.Strategies.Startegy_SSPOP_RSI.SsPopStrategy(p, prices);
                                        Close();
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }