Пример #1
0
 /// <summary>
 /// This method is used to configure the strategy and is called once before any strategy method is called.
 /// </summary>
 public virtual void Initialize(RobotContext robotContext, CurrentProtectedContext protectedContext)
 {
     this.protectedContext = protectedContext;
     this.robotContext = robotContext;
     TerminalLog.Instance.SaveRobotLog(string.Format("Запущен робот {0} #{1}",
         GetUniqueName(), robotContext.AccountInfo.ID));
     if ((FixedVolume ?? 0) <= 0 && (Leverage ?? 0) <= 0)
         if (lastMessages != null)
             lastMessages.Add("Не указаны ни плечо сделки, ни фиксированный объем входа. Торговля осуществляться не будет");
 }
Пример #2
0
        public override void Initialize(RobotContext grobotContext, CurrentProtectedContext gprotectedContext)
        {
            base.Initialize(grobotContext, gprotectedContext);

            packers = Graphics.ToDictionary(g => g.a, g => new CandlePacker(g.b));
            rsiClosePairs = Graphics.ToDictionary(g => g.a, g => new RestrictedQueue<PriceRsi>(period));

            lastMessages = new List<string>();
        }
Пример #3
0
 public override void Initialize(RobotContext grobotContext, CurrentProtectedContext protectedContextx)
 {
     base.Initialize(grobotContext, protectedContextx);
     if (Graphics.Count == 0)
     {
         Logger.DebugFormat("OptionTraderRobot: настройки графиков не заданы");
         return;
     }
     tickers = Graphics.Select(r => r.a).ToArray();
     tickerVolatility = tickers.ToDictionary(t => t,
         t => Model == PriceModel.Gauss ?
             (IVolatilityCalculator)new GaussVolatilityCalculator(200) : new ReverseVolatilityCalculator(1000));
 }
Пример #4
0
 public override void Initialize(RobotContext context, CurrentProtectedContext protectedContext)
 {
     var cfgFileName = Assembly.GetAssembly(GetType()).Location + ".xml";
     string error;
     newsSettings = NewsSettings.LoadNewsSettings(cfgFileName, out error);
     if (error != null)
         pendingLogMessages.Add(error);
     currencySettings = CurrencySettings.LoadCurrencySettings(cfgFileName, out error);
     if (error != null)
         pendingLogMessages.Add(error);
     if(string.IsNullOrEmpty(Formula))
         pendingLogMessages.Add("формула не задана");
     try
     {
         expressionResolver = new ExpressionResolver(Formula.ToLower());
     }
     catch (Exception)
     {
         pendingLogMessages.Add("ошибка в формуле");
     }
     base.Initialize(context, protectedContext);
 }
 public override void Initialize(RobotContext robotContext, CurrentProtectedContext protectedContext)
 {
     base.Initialize(robotContext, protectedContext);
     if (Graphics.Count == 0)
     {
         Logger.DebugFormat("OptionUpDownMartinRobot: настройки графиков не заданы");
         return;
     }
     packers = Graphics.ToDictionary(g => g.a, g => new CandlePacker(g.b));
     lastCandles = Graphics.ToDictionary(g => g.a, g => new RestrictedQueue<CandleData>(candlesBeforeEnter));
     betsBySymbol = Graphics.ToDictionary(g => g.a, g => new List<Bet>());
     betsHistory = Graphics.ToDictionary(g => g.a, g => new List<Bet>());
     balance = StartDepo;
     maxBalance = StartDepo;
     betNumberWhenDepoWasLost = 0;
 }
Пример #6
0
 public override void Initialize(RobotContext grobotContext, CurrentProtectedContext protectedContext)
 {
     base.Initialize(grobotContext, protectedContext);
     // проверка настроек графиков
     if (Graphics.Count == 0)
     {
         Logger.DebugFormat("SlideChannelRobot: настройки графиков не заданы");
         return;
     }
     if (Graphics.Count > 1)
     {
         Logger.DebugFormat("SlideChannelRobot: настройки графиков должны описывать один тикер / один ТФ");
         return;
     }
     ticker = Graphics[0].a;
     packer = new CandlePacker(Graphics[0].b);
     candles = new List<CandleData>();
 }