Example #1
0
        private void CalculateStrategy()
        {
            foreach (IndicatorSlot indSlot in Data.Strategy.Slot)
            {
                string    indicatorName = indSlot.IndicatorName;
                SlotTypes slotType      = indSlot.SlotType;
                Indicator indicator     = IndicatorManager.ConstructIndicator(indicatorName);
                indicator.Initialize(slotType);
                indicator.IndParam = indSlot.IndParam;
                indicator.Calculate(Data.DataSet);

                indSlot.IndicatorName  = indicator.IndicatorName;
                indSlot.IndParam       = indicator.IndParam;
                indSlot.Component      = indicator.Component;
                indSlot.SeparatedChart = indicator.SeparatedChart;
                indSlot.SpecValue      = indicator.SpecialValues;
                indSlot.MinValue       = indicator.SeparatedChartMinValue;
                indSlot.MaxValue       = indicator.SeparatedChartMaxValue;
                indSlot.IsDefined      = true;
            }

            Data.FirstBar = Data.Strategy.SetFirstBar();
            Backtester.Calculate();
            Backtester.CalculateAccountStats();
            Data.IsResult = true;
            StatsBuffer.UpdateStatsBuffer();
        }