Ejemplo n.º 1
0
        public OptimizerMaster()
        {
            _log = new Log("OptimizerLog", StartProgram.IsOsOptimizer);
            _log.Listen(this);

            _threadsCount = 1;
            _startDepozit = 100000;

            Storage = new OptimizerDataStorage("Prime");
            Storage.SecuritiesChangeEvent += _storage_SecuritiesChangeEvent;
            Storage.TimeChangeEvent       += _storage_TimeChangeEvent;

            _filterProfitValue       = 10;
            _filterProfitIsOn        = false;
            _filterMaxDrowDownValue  = -10;
            _filterMaxDrowDownIsOn   = false;
            _filterMiddleProfitValue = 0.001m;
            _filterMiddleProfitIsOn  = false;
            _filterProfitFactorValue = 1;
            _filterProfitFactorIsOn  = false;

            _percentOnFilration = 30;

            Load();

            _optimizerExecutor = new OptimizerExecutor(this);
            _optimizerExecutor.LogMessageEvent            += SendLogMessage;
            _optimizerExecutor.TestingProgressChangeEvent += _optimizerExecutor_TestingProgressChangeEvent;
            _optimizerExecutor.PrimeProgressChangeEvent   += _optimizerExecutor_PrimeProgressChangeEvent;
            _optimizerExecutor.TestReadyEvent             += _optimizerExecutor_TestReadyEvent;
            _optimizerExecutor.NeadToMoveUiToEvent        += _optimizerExecutor_NeadToMoveUiToEvent;
            ProgressBarStatuses    = new List <ProgressBarStatus>();
            PrimeProgressBarStatus = new ProgressBarStatus();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// запустить оптимизацию
        /// </summary>
        /// <returns>true - если запуск прошёл успешно</returns>
        public bool Start()
        {
            if (CheckReadyData() == false)
            {
                return(false);
            }

            if (_optimizerExecutor.Start(_paramOn, _parameters))
            {
                ProgressBarStatuses    = new List <ProgressBarStatus>();
                PrimeProgressBarStatus = new ProgressBarStatus();
            }
            return(true);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Progress on a specific robot has changed
        /// изменился прогресс по определённому роботу
        /// </summary>
        /// <param name="curVal">current value for progress bar/текущее значение для прогрессБара</param>
        /// <param name="maxVal">maximum value for progress bar/максимальное значение для прогрессБара</param>
        /// <param name="numServer">server number/номер сервера</param>
        void _optimizerExecutor_TestingProgressChangeEvent(int curVal, int maxVal, int numServer)
        {
            ProgressBarStatus status = ProgressBarStatuses.Find(st => st.Num == numServer);

            if (status == null)
            {
                status     = new ProgressBarStatus();
                status.Num = numServer;
                ProgressBarStatuses.Add(status);
            }

            status.CurrentValue = curVal;
            status.MaxValue     = maxVal;
        }
Ejemplo n.º 4
0
        public OptimizerMaster()
        {
            _log = new Log("OptimizerLog", StartProgram.IsOsOptimizer);
            _log.Listen(this);

            _threadsCount = 1;
            _startDepozit = 100000;

            Storage = new OptimizerDataStorage();
            Storage.SecuritiesChangeEvent += _storage_SecuritiesChangeEvent;
            Storage.TimeChangeEvent       += _storage_TimeChangeEvent;

            _filterProfitValue       = 10;
            _filterProfitIsOn        = false;
            _filterMaxDrowDownValue  = -10;
            _filterMaxDrowDownIsOn   = false;
            _filterMiddleProfitValue = 0.001m;
            _filterMiddleProfitIsOn  = false;
            _filterWinPositionValue  = 40;
            _filterWinPositionIsOn   = false;
            _filterProfitFactorValue = 1;
            _filterProfitFactorIsOn  = false;

            _percentOnFilration = 30;

            Load();

            _fazeCount = 1;

            SendLogMessage("Начинаем проверку всех стратегий в системе на наличие параметров", LogMessageType.System);

            for (int i = 0; i < 3; i++)
            {
                Thread worker = new Thread(GetNamesStrategyToOptimization);
                worker.Name         = i.ToString();
                worker.IsBackground = true;
                worker.Start();
            }

            _optimizerExecutor = new OptimizerExecutor(this);
            _optimizerExecutor.LogMessageEvent            += SendLogMessage;
            _optimizerExecutor.TestingProgressChangeEvent += _optimizerExecutor_TestingProgressChangeEvent;
            _optimizerExecutor.PrimeProgressChangeEvent   += _optimizerExecutor_PrimeProgressChangeEvent;
            _optimizerExecutor.TestReadyEvent             += _optimizerExecutor_TestReadyEvent;
            _optimizerExecutor.NeadToMoveUiToEvent        += _optimizerExecutor_NeadToMoveUiToEvent;
            ProgressBarStatuses    = new List <ProgressBarStatus>();
            PrimeProgressBarStatus = new ProgressBarStatus();
        }