public PrepareForTrade(GlobalObjects.TimeInterval Interval, string ContractName, Parameter_EMA_Scalp Parameter, DateTime StartPeriod)
 {
     _Interval = Interval;
     _ContractName = ContractName;
     _Start = StartPeriod;
     _Param = Parameter;
 }
        public static List<Trade> EmaScalp(Parameter_EMA_Scalp P, List<Price> price, bool tradeOnly)
        {
            A_1 = Factory_Indicator.createEMA(P.A_EMA1, price);
            A_6 = Factory_Indicator.createEMA(P.A_EMA2, price);
            B_1 = Factory_Indicator.createEMA(P.B_EMA1, price);
            B_6 = Factory_Indicator.createEMA(P.B_EMA2, price);
            E1 = Factory_Indicator.createEMA(P.C_EMA, price);

            DateTime sd = E1[0].TimeStamp;
            
            CutToSize(sd);
            TradeStrategy _strategy = new TradeStrategy(price, P, B_6[0].TimeStamp, CalcTriggers,CalcTriggers2 );

            _strategy.Calculate();
            _T = _strategy.getStrategyList();
            //for (int x = 0; x < _T.Count; x++) DP(x);


            // _strategy.ClearList(); //FOR SIMULATOR
            return GetTradeData(tradeOnly); // REAL TRADING
            //  Clear();//FOR SIMULATOR

            return new List<Trade>();

        }
Exemplo n.º 3
0
        public static List <Trade> EmaScalp(Parameter_EMA_Scalp P, List <Price> price, bool tradeOnly)
        {
            A_1 = Factory_Indicator.createEMA(P.A_EMA1, price);
            A_6 = Factory_Indicator.createEMA(P.A_EMA2, price);
            B_1 = Factory_Indicator.createEMA(P.B_EMA1, price);
            B_6 = Factory_Indicator.createEMA(P.B_EMA2, price);
            E1  = Factory_Indicator.createEMA(P.C_EMA, price);

            DateTime sd = E1[0].TimeStamp;

            CutToSize(sd);
            TradeStrategy _strategy = new TradeStrategy(price, P, B_6[0].TimeStamp, CalcTriggers, CalcTriggers2);

            _strategy.Calculate();
            _T = _strategy.getStrategyList();
            //for (int x = 0; x < _T.Count; x++) DP(x);


            // _strategy.ClearList(); //FOR SIMULATOR
            return(GetTradeData(tradeOnly)); // REAL TRADING

            //  Clear();//FOR SIMULATOR

            return(new List <Trade>());
        }
Exemplo n.º 4
0
 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;                          
 }
        public static List<Trade> RunEMAScalpLiveTrade(Parameter_EMA_Scalp Parameter, DateTime StartDate, GlobalObjects.TimeInterval Interval)
        {
            //  DateTime START = new DateTime(2012,06,02);//NB must be set periodically           
            DateTime e = DateTime.UtcNow.AddHours(5);
            UpdateDB.MergeTempWithHisto(Interval);
            GlobalObjects.Points = AlsiUtils.DataBase.readDataFromDataBase(Interval, AlsiUtils.DataBase.dataTable.Temp, StartDate, e, false);
            var sp = GlobalObjects.Points.First();
            var l = GlobalObjects.Points.Last();
            return AlsiUtils.Strategies.EMA_Scalp.EmaScalp(Parameter, GlobalObjects.Points, false);

        }
Exemplo n.º 6
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];
        }
        public static Parameter_EMA_Scalp GetParameters()
        {
            AlsiUtils.Strategies.Parameter_EMA_Scalp E = new AlsiUtils.Strategies.Parameter_EMA_Scalp()
            {
                A_EMA1 = WebSettings.Indicators.EmaScalp.A1,
                A_EMA2 = WebSettings.Indicators.EmaScalp.A2,
                B_EMA1 = WebSettings.Indicators.EmaScalp.B1,
                B_EMA2 = WebSettings.Indicators.EmaScalp.B2,
                C_EMA = WebSettings.Indicators.EmaScalp.C1,
                TakeProfit = WebSettings.General.TAKE_PROFIT,
                StopLoss = WebSettings.General.STOPLOSS,
                CloseEndofDay = false,
                //Period = GlobalObjects.Prices.Count,


            };

            return E;
        }
 public static List<Trade> RunEMAScalp(Parameter_EMA_Scalp Parameter, GlobalObjects.TimeInterval Interval, bool TradesOnly, DateTime Start, DateTime End, DataBase.dataTable Table)
 {
     GlobalObjects.Points = AlsiUtils.DataBase.readDataFromDataBase(Interval, Table, Start, End, false);
     return AlsiUtils.Strategies.EMA_Scalp.EmaScalp(Parameter, GlobalObjects.Points, TradesOnly);
 }