示例#1
0
        public void RunMultiple()
        {
            //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, 08, 01);
            DateTime end = new DateTime(2013, 01, 01);



            var prices = AlsiUtils.DataBase.readDataFromDataBase(GlobalObjects.TimeInterval.Minute_2, AlsiUtils.DataBase.dataTable.MasterMinute,
                                                                 s, end, false);

            Debug.WriteLine("Start Date " + prices[0].TimeStamp);

            for (int x = ema.A1_start; x <= ema.A1_end; x++)
            {
                for (int y = ema.A2_start; y <= ema.A2_end; y++)
                {
                    for (int a = ema.B1_start; a <= ema.B1_end; a++)
                    {
                        for (int b = ema.B1_start; b <= ema.B2_end; b++)
                        {
                            for (int z = ema.C1_start; z <= ema.C1_end; z++)
                            {
                                if (x < y && y < a && a < b && b < z)
                                {
                                    E = new AlsiUtils.Strategies.Parameter_EMA_Scalp()
                                    {
                                        A_EMA1        = x,
                                        A_EMA2        = y,
                                        B_EMA1        = a,
                                        B_EMA2        = b,
                                        C_EMA         = z,
                                        TakeProfit    = 1000,
                                        StopLoss      = -1000,
                                        CloseEndofDay = true,
                                        Period        = 2012,
                                    };


                                    // var Trades = AlsiUtils.Strategies.EMA_Scalp.EmaScalp(E, prices, false);
                                    var Trades = AlsiUtils.Strategies.EmaSalp2.EmaScalp(E, prices, false);
                                    if (Trades.Count != 0)
                                    {
                                        S.CalcBasicTradeStats(Trades);
                                    }
                                    //if (Trades.Count != 0) S.CalcBasicTradeStats_old(Trades);
                                }
                            }
                        }
                    }
                }
            }
        }
示例#2
0
        public void RunSingleNEW()
        {
            //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(2006, 01, 01);
            //  DateTime e = new DateTime(2006, 12, 15);

            DateTime s = new DateTime(2011, 12, 15);
            DateTime e = new DateTime(2013, 09, 29);



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

            Debug.WriteLine("Start Date " + prices[0].TimeStamp);

            //for (int x = 2; x < 50; x++)
            //{

            AlsiUtils.Strategies.Parameter_EMA_Scalp E = new AlsiUtils.Strategies.Parameter_EMA_Scalp()
            {
                A_EMA1        = 18,
                A_EMA2        = 19,
                B_EMA1        = 25,
                B_EMA2        = 26,
                C_EMA         = 32,
                TakeProfit    = 25,
                StopLoss      = -25,
                CloseEndofDay = true,
                Period        = prices.Count,
            };

            var Trades = AlsiUtils.Strategies.EmaSalp2.EmaScalp(E, prices, false);

            S = new AlsiUtils.Statistics();
            S.OnStatsCaculated += new AlsiUtils.Statistics.StatsCalculated(S_OnStatsCaculated);

            //var Trades = AlsiUtils.Strategies.EMA_Scalp.EmaScalp(E, prices, false);

            Trades = S.CalcBasicTradeStats(Trades);
            // var NewTrades = AlsiUtils.Strategies.TradeStrategy.Expansion.ApplyRegressionFilter(10, Trades);
            // NewTrades = S.CalcExpandedTradeStats(NewTrades);

            // PrintTradesonly(Trades);
        }
        public void RunSingleNEW()
        {
            //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(2006, 01, 01);
            //  DateTime e = new DateTime(2006, 12, 15);

            DateTime s = new DateTime(2011, 12, 15);
            DateTime e = new DateTime(2013, 09, 29);

          

            var prices = AlsiUtils.DataBase.readDataFromDataBase(GlobalObjects.TimeInterval.Minute_5, AlsiUtils.DataBase.dataTable.MasterMinute,
               s, e, false);
            Debug.WriteLine("Start Date " + prices[0].TimeStamp);

            //for (int x = 2; x < 50; x++)
            //{

            AlsiUtils.Strategies.Parameter_EMA_Scalp E = new AlsiUtils.Strategies.Parameter_EMA_Scalp()
            {
                A_EMA1 = 18,
                A_EMA2 = 19,
                B_EMA1 = 25,
                B_EMA2 = 26,
                C_EMA = 32,
                TakeProfit = 25,
                StopLoss = -25,
                CloseEndofDay = true,
                Period = prices.Count,
            };

           var Trades =AlsiUtils.Strategies.EmaSalp2.EmaScalp(E, prices, false);
           S = new AlsiUtils.Statistics();
           S.OnStatsCaculated += new AlsiUtils.Statistics.StatsCalculated(S_OnStatsCaculated);
           
            //var Trades = AlsiUtils.Strategies.EMA_Scalp.EmaScalp(E, prices, false);

            Trades = S.CalcBasicTradeStats(Trades);
           // var NewTrades = AlsiUtils.Strategies.TradeStrategy.Expansion.ApplyRegressionFilter(10, Trades);
           // NewTrades = S.CalcExpandedTradeStats(NewTrades);

            // PrintTradesonly(Trades);


        }