void CalculateIndicator(int slot)
{
IndicatorParam ip = Data.Strategy.Slot[slot].IndParam;
Indicator indicator = Indicator_Store.ConstructIndicator(ip.IndicatorName, ip.SlotType);
// List params
for (int i = 0; i < 5; i++)
{
indicator.IndParam.ListParam[i].Index = ip.ListParam[i].Index;
indicator.IndParam.ListParam[i].Text = ip.ListParam[i].Text;
indicator.IndParam.ListParam[i].Enabled = ip.ListParam[i].Enabled;
}
// Numeric params
for (int i = 0; i < 6; i++)
{
indicator.IndParam.NumParam[i].Value = ip.NumParam[i].Value;
indicator.IndParam.NumParam[i].Enabled = ip.NumParam[i].Enabled;
}
// Check params
for (int i = 0; i < 2; i++)
{
indicator.IndParam.CheckParam[i].Checked = ip.CheckParam[i].Checked;
indicator.IndParam.CheckParam[i].Enabled = ip.CheckParam[i].Enabled;
}
indicator.Calculate(ip.SlotType);
// 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 the Data.FirstBar
Data.FirstBar = 0;
foreach (IndicatorSlot indSlot in Data.Strategy.Slot)
foreach (IndicatorComp indComp in indSlot.Component)
if (indComp.FirstBar > Data.FirstBar)
Data.FirstBar = indComp.FirstBar;
return;
}