/// <summary>
        ///     Calculates the selected indicator.
        /// </summary>
        private void CalculateIndicator(bool bCalculateStrategy)
        {
            if (!Data.IsData || !Data.IsResult || !isPaint)
            {
                return;
            }

            SetOppositeSignalBehaviour();
            SetClosingLogicConditions();

            Indicator indicator = IndicatorManager.ConstructIndicator(indicatorName);

            indicator.Initialize(slotType);

            // List parameters
            for (int i = 0; i < 5; i++)
            {
                indicator.IndParam.ListParam[i].Index   = ListParam[i].SelectedIndex;
                indicator.IndParam.ListParam[i].Text    = ListParam[i].Text;
                indicator.IndParam.ListParam[i].Enabled = ListParam[i].Enabled;
            }

            // Numeric parameters
            for (int i = 0; i < 6; i++)
            {
                indicator.IndParam.NumParam[i].Value   = (double)NumParam[i].Value;
                indicator.IndParam.NumParam[i].Enabled = NumParam[i].Enabled;
            }

            // Check parameters
            for (int i = 0; i < 2; i++)
            {
                indicator.IndParam.CheckParam[i].Checked = CheckParam[i].Checked;
                indicator.IndParam.CheckParam[i].Enabled = CheckParam[i].Enabled;
                indicator.IndParam.CheckParam[i].Enabled = CheckParam[i].Text == "Use previous bar value" ||
                                                           CheckParam[i].Enabled;
            }

            if (!CalculateIndicator(slotType, indicator))
            {
                return;
            }

            if (bCalculateStrategy)
            {
                //Sets Data.Strategy
                Data.Strategy.Slot[slot].IndicatorName  = indicator.IndicatorName;
                Data.Strategy.Slot[slot].IndParam       = indicator.IndParam;
                Data.Strategy.Slot[slot].Component      = indicator.Component;
                Data.Strategy.Slot[slot].SeparatedChart = indicator.SeparatedChart;
                Data.Strategy.Slot[slot].SpecValue      = indicator.SpecialValues;
                Data.Strategy.Slot[slot].MinValue       = indicator.SeparatedChartMinValue;
                Data.Strategy.Slot[slot].MaxValue       = indicator.SeparatedChartMaxValue;
                Data.Strategy.Slot[slot].IsDefined      = true;

                // Search the indicators' components to determine Data.FirstBar
                Data.FirstBar = Data.Strategy.SetFirstBar();

                // Check "Use previous bar value"
                if (Data.Strategy.AdjustUsePreviousBarValue())
                {
                    for (int i = 0; i < 2; i++)
                    {
                        if (indicator.IndParam.CheckParam[i].Caption == "Use previous bar value")
                        {
                            AChbCheck[i].Checked = Data.Strategy.Slot[slot].IndParam.CheckParam[i].Checked;
                        }
                    }
                }

                Backtester.Calculate();
                Backtester.CalculateAccountStats();
            }

            SetIndicatorNotification(indicator);

            Data.IsResult = true;
        }
 private void CalculateStrategy()
 {
     Backtester.Calculate();
     Backtester.CalculateAccountStats();
 }