Exemplo n.º 1
0
 public override void Initialize(BacktestServerProxy.RobotContext grobotContext,
                                 Contract.Util.BL.CurrentProtectedContext protectedContextx)
 {
     base.Initialize(grobotContext, protectedContextx);
     packers   = Graphics.ToDictionary(g => g.a, g => new CandlePacker(g.b));
     digitsDen = (int)Math.Pow(10, roundDigits);
 }
Exemplo n.º 2
0
 public override void Initialize(BacktestServerProxy.RobotContext grobotContext,
                                 Contract.Util.BL.CurrentProtectedContext protectedContextx)
 {
     base.Initialize(grobotContext, protectedContextx);
     if (Graphics.Count == 0)
     {
         Logger.DebugFormat("CaymanRobot: настройки графиков не заданы");
         return;
     }
     if (Graphics.Count > 1)
     {
         Logger.DebugFormat("CaymanRobot: настройки графиков должны описывать один тикер / один ТФ");
         return;
     }
     packer = new CandlePacker(Graphics[0].b);
     ticker = Graphics[0].a;
     ReadCaymanHistory();
 }
Exemplo n.º 3
0
 public override void Initialize(BacktestServerProxy.RobotContext grobotContext,
                                 Contract.Util.BL.CurrentProtectedContext protectedContextx)
 {
     base.Initialize(grobotContext, protectedContextx);
     if (Graphics.Count == 0)
     {
         Logger.DebugFormat("TailBodyRobot: настройки графиков не заданы");
         return;
     }
     if (Graphics.Count > 1)
     {
         Logger.DebugFormat("TailBodyRobot: настройки графиков должны описывать один тикер / один ТФ");
         return;
     }
     packer    = new CandlePacker(Graphics[0].b);
     ticker    = Graphics[0].a;
     pointCost = 1.0 / DalSpot.Instance.GetPrecision10(ticker);
 }
Exemplo n.º 4
0
        public override void Initialize(BacktestServerProxy.RobotContext grobotContext,
                                        Contract.Util.BL.CurrentProtectedContext protectedContextx)
        {
            base.Initialize(grobotContext, protectedContextx);
            if (Graphics.Count == 0)
            {
                Logger.DebugFormat("CounterNettoRobot: настройки графиков не заданы");
                return;
            }

            packers = Graphics.ToDictionary(g => g.a, g => new CandlePacker(g.b));

            if (!File.Exists(NettoFilePath))
            {
                Logger.DebugFormat("CounterNettoRobot: файл не найден");
                return;
            }
            nettoReader = new StreamReader(NettoFilePath, Encoding.ASCII);
            NettoRecord.ReadHeader(nettoReader);
            cur  = NettoRecord.ReadNext(nettoReader);
            next = NettoRecord.ReadNext(nettoReader);
        }
Exemplo n.º 5
0
        public override void Initialize(BacktestServerProxy.RobotContext grobotContext, Contract.Util.BL.CurrentProtectedContext gprotectedContext)
        {
            base.Initialize(grobotContext, gprotectedContext);

            if (Graphics.Count == 0)
            {
                return;
            }

            plannedOrders = new List <Cortege3 <string, int, DateTime> >();
            rnd           = new Random();
            packers       = Graphics.ToDictionary(g => g, g => new CandlePacker(g.b));

            // перевести рабочие часы в удобную форму
            workHours.Clear();
            var workHoursParts = WorkingHours.ToIntArrayUniform();

            for (var i = 0; i < workHoursParts.Length / 2; i++)
            {
                var start = workHoursParts[i * 2];
                var end   = workHoursParts[i * 2 + 1];
                if (end == start || end < start)
                {
                    continue;
                }

                workHours.Add(new Cortege2 <int, int>(start, end));
            }

            if (workHours.Count < 1)
            {
                workHours.Clear();
                workHours.AddRange(new List <Cortege2 <int, int> > {
                    new Cortege2 <int, int>(10, 18), new Cortege2 <int, int>(20, 22)
                });
            }
        }
Exemplo n.º 6
0
        public override void Initialize(BacktestServerProxy.RobotContext grobotContext, Contract.Util.BL.CurrentProtectedContext protectedContextx)
        {
            base.Initialize(grobotContext, protectedContextx);
            if (Graphics.Count == 0)
            {
                Logger.DebugFormat("RobotMA: настройки графиков не заданы");
                return;
            }
            if (Graphics.Count > 1)
            {
                Logger.DebugFormat("RobotMA: настройки графиков должны описывать один тикер / один ТФ");
                return;
            }
            packer     = new CandlePacker(Graphics[0].b);
            ticker     = Graphics[0].a;
            stopLoss   = null;
            takeProfit = null;


            extremumRangeQueue = new RestrictedQueue <CandleData>(ExtremumRange * 2 + 1);
            extremumQueue      = new RestrictedQueue <Cortege3 <float, bool, DateTime> >(4);
        }