Exemplo n.º 1
0
        public WeeklyDataDisplayer(Strategy vtrades, bool visIntraDay, DateTime startTime, DateTime endTime)
            : base(vtrades, visIntraDay, startTime, endTime)
        {
            DateTimeFormatInfo dtfInfo = DateTimeFormatInfo.GetInstance(CultureInfo.CurrentCulture);

            _dateTimeFormat = "dd" + dtfInfo.DateSeparator.ToString() + "MM" + dtfInfo.DateSeparator.ToString() + "yyyy" +
                              " HH:mm:ss";
            _dayindexer = 0;
            _weekindexer = 0;
            _tradeindexer = 0;
            _isFullWeek = false;
            _tempDayOfYear = Trades[0].TimeOpen.DayOfYear;
            _currDayOfYear = _tempDayOfYear;
            _currentweek = Trades[0].TimeOpen.DayOfYear;
            _tempweek = Trades[0].TimeOpen.DayOfYear;

            _currWeek = Trades[0].TimeOpen;
            _startWeek = Trades[0].TimeOpen;
            _endWeek = Trades[0].TimeOpen;
            _tempTrades = Trades;

            _weeklyData = new WeeklyData();

            _weeklyData.Relations.Add("1", _weeklyData.Tables["tableWeek"].Columns["id"],
                                   _weeklyData.Tables["tableDays"].Columns["id_Week"], false);
            _weeklyData.Relations.Add("2", _weeklyData.Tables["tableDays"].Columns["id"],
                                   _weeklyData.Tables["tableTrades"].Columns["id_Day"], false);

            CreateDataTablesFromTrades();
        }
Exemplo n.º 2
0
 private static void NotifyResultEvent(Strategy strategy)
 {
     if (ResultEvent != null)
     {
         ResultEvent(strategy);
     }
 }
Exemplo n.º 3
0
 protected Displayer(Strategy vtrades, bool visIntraDay, DateTime startDate, DateTime endTime)
 {
     Strategy = vtrades;
        Symbol = vtrades.Parameters.Symbol;
        Trades = vtrades.Trades;
        IsIntraday = visIntraDay;
        MinDt = startDate;
        MaxDt = endTime;
        Strategyperformance = new StrategyPerfomance(Trades, Ticksize, IsIntraday, MinDt, MaxDt);
 }
Exemplo n.º 4
0
 private static void InitializeStrategy()
 {
     _strategy = new StepChange
         {
             Ticks = _ticks,
             AdditionalParameters = _strategyAdditionalParameters,
             Parameters = new Strategy.StrategyParameters(_strategyParameterses.Account
                                                          , _strategyParameterses.Symbol
                                                          , _strategyParameterses.Name)
         };
 }
Exemplo n.º 5
0
        public static void StartBackTest(Strategy.StrategyParameters parameters, List<Strategy.StrategyAdditionalParameter> additionalParameters, List<Tick> ticks)
        {
            _strategyParameterses = parameters;
            _strategyAdditionalParameters = additionalParameters;
            _ticks = ticks;

            InitializeStrategy();

            _strategy.ProgressEvent += NotifyProgressEvent;

            _strategy.Start(0);

            NotifyResultEvent(_strategy);
        }
Exemplo n.º 6
0
 public SummaryDisplayer(Strategy vtrades, bool visIntraDay, DateTime startDate, DateTime endDate)
     : base(vtrades, visIntraDay, startDate, endDate)
 {
 }
Exemplo n.º 7
0
 public TradeDisplayer(Strategy vtrades, bool visIntraDay, DateTime startTime, DateTime endTime)
     : base(vtrades, visIntraDay, startTime, endTime)
 {
 }
Exemplo n.º 8
0
        private void Initialize(int index, Strategy.StrategyParameters parameters)
        {
            switch (index)
            {
                case 0:
                    {
                        var additional8 = new Strategy.StrategyAdditionalParameter("", "Stop Level", 80 * _tickSize, typeof(double), false);
                        var additional9 = new Strategy.StrategyAdditionalParameter("", "Reversal Level", 80 * _tickSize, typeof(double), false);

                        List<Strategy.StrategyAdditionalParameter> additional = UpdateAdditionalParams();

                        additional.Add(additional8);
                        additional.Add(additional9);

                        _strategy = new StepChange(parameters, additional, ref _data);

                        break;
                    }
                default: // Other Unregistered Strategies
                    {
                        Report("The selected strategy is not registered. Please, select a registered strategy.", InformerMessageType.Error);
                        break;
                    }
            }
        }
Exemplo n.º 9
0
        private void DisplayBackTestResult(Strategy strategy)
        {
            var summaryDisplayer = new SummaryDisplayer(strategy, true, _inSampleStartTime, _inSampleEndTime);

            Invoke((Action)(() => summaryDisplayer.DisplayTable(uiSummary_dataGridViewBT)));

            if (uiStrategy_checkBoxXRunContinuesCheck.Checked == false)
            {
                if (strategy.Trades != null)
                {
                    _weekData = new WeeklyDataDisplayer(strategy, true, _inSampleStartTime, _inSampleEndTime);
                    uiWeeklyData_superGridControlTable.PrimaryGrid.DataSource = _weekData._weeklyData;

                    _calendarDisplayer = new CalendarDisplayer(_weekData);
                    Invoke((Action)InitCalendar);
                    Invoke((Action)(() => uiCalendar_buttonXSave.Enabled = true));
                }
            }
        }