public static List<Trade> DoYourThing(string Instrument,Parameter_EMA_Scalp Param,DateTime StartPeriod)
 {              
     Statistics _Stats = new Statistics();
     GlobalObjects.TimeInterval t = GlobalObjects.TimeInterval.Minute_5;
     DataBase.dataTable dt = DataBase.dataTable.MasterMinute;
     var _tempTradeList = AlsiTrade_Backend.RunCalcs.RunEMAScalp(Param, t, false, StartPeriod, DateTime.Now.AddHours(5), dt);
     var _trades = _Stats.CalcBasicTradeStats_old(_tempTradeList);
     return _trades;                          
 }
Beispiel #2
0
        public static Trade GetLastTrade(Parameter_EMA_Scalp Parameter, GlobalObjects.TimeInterval t)
        {
            var _Stats = new AlsiUtils.Statistics();
            var dt     = DataBase.dataTable.MasterMinute;

            var _tempTradeList = AlsiTrade_Backend.RunCalcs.RunEMAScalp(Parameter, t, true, DateTime.Now.AddMonths(-1), DateTime.Now.AddHours(12), dt);
            var _trades        = _Stats.CalcBasicTradeStats_old(_tempTradeList);

            _trades.Reverse();

            return(_trades[0]);
        }
Beispiel #3
0
        private void TradeToCandle()
        {
            //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(2012, 1, 1);
            DateTime e = new DateTime(2013, 12, 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        = 16,
                A_EMA2        = 17,
                B_EMA1        = 43,
                B_EMA2        = 45,
                C_EMA         = 52,
                TakeProfit    = 450,
                StopLoss      = -300,
                CloseEndofDay = false,
                Period        = prices.Count,
            };
            //  takep = E.TakeProfit;
            // takel = E.StopLoss;
            AlsiUtils.Statistics 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_old(Trades);

            var rr = Statistics.IntratradeToCandle(Trades);
            var RR = CompletedTrade.CreateList(rr);



            PrintTradesonly(RR);
        }
        public static Trade GetLastTrade(Parameter_EMA_Scalp Parameter, GlobalObjects.TimeInterval t)
        {
            var _Stats = new AlsiUtils.Statistics();
            var dt = DataBase.dataTable.MasterMinute;

            var _tempTradeList = AlsiTrade_Backend.RunCalcs.RunEMAScalp(Parameter, t, true, DateTime.Now.AddMonths(-1), DateTime.Now.AddHours(12), dt);
            var _trades = _Stats.CalcBasicTradeStats_old(_tempTradeList);
            _trades.Reverse();

            return _trades[0];
        }
        public void RunSingle()
        {
            //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(2012, 1, 1);
            DateTime e = new DateTime(2013, 12, 29);


            var prices = AlsiUtils.DataBase.readDataFromDataBase(GlobalObjects.TimeInterval.Minute_2, 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 = 16,
                A_EMA2 = 17,
                B_EMA1 = 43,
                B_EMA2 = 45,
                C_EMA = 52,
                TakeProfit = 450,
                StopLoss = -300,
                CloseEndofDay = false,
                Period = prices.Count,

            };
            //takep = E.TakeProfit;
            //takel = E.StopLoss;
            AlsiUtils.Statistics 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_old(Trades);
            var NewTrades = AlsiUtils.Strategies.TradeStrategy.Expansion.ApplyRegressionFilter(10, Trades);
            NewTrades = S.CalcExpandedTradeStats(NewTrades);

           // PrintTradesonly(NewTrades);

           
        }