void SetupIndicatorPanels()
{
pnlPrice = new Panel();
pnlPrice.Parent = pnlCharts;
pnlPrice.Dock = DockStyle.Fill;
pnlPrice.BackColor = LayoutColors.ColorChartBack;
pnlPrice.MouseLeave += new EventHandler(PnlPrice_MouseLeave);
pnlPrice.MouseDoubleClick += new MouseEventHandler(PnlPrice_MouseDoubleClick);
pnlPrice.MouseMove += new MouseEventHandler(PnlPrice_MouseMove);
pnlPrice.MouseDown += new MouseEventHandler(Panel_MouseDown);
pnlPrice.MouseUp += new MouseEventHandler(Panel_MouseUp);
pnlPrice.Paint += new PaintEventHandler(PnlPrice_Paint);
// Indicator panels
indPanels = 0;
string[] asIndicatorTexts = new string[Data.Strategy.Slots];
for (int iSlot = 0; iSlot < Data.Strategy.Slots; iSlot++)
{
Indicator indicator = Indicator_Store.ConstructIndicator(Data.Strategy.Slot[iSlot].IndicatorName, Data.Strategy.Slot[iSlot].SlotType);
indicator.IndParam = Data.Strategy.Slot[iSlot].IndParam;
asIndicatorTexts[iSlot] = indicator.ToString();
indPanels += Data.Strategy.Slot[iSlot].SeparatedChart ? 1 : 0;
}
// Repeated indicators
repeatedIndicator = new bool[Data.Strategy.Slots];
for (int iSlot = 0; iSlot < Data.Strategy.Slots; iSlot++)
{
repeatedIndicator[iSlot] = false;
for (int i = 0; i < iSlot; i++)
repeatedIndicator[iSlot] = asIndicatorTexts[iSlot] == asIndicatorTexts[i];
}
pnlInd = new Panel[indPanels];
splitterInd = new Splitter [indPanels];
for (int i = 0; i < indPanels; i++)
{
splitterInd[i] = new Splitter();
splitterInd[i].BorderStyle = BorderStyle.None;
splitterInd[i].Dock = DockStyle.Bottom;
splitterInd[i].Height = 2;
pnlInd[i] = new Panel();
pnlInd[i].Dock = DockStyle.Bottom;
pnlInd[i].BackColor = LayoutColors.ColorControlBack;
pnlInd[i].Paint += new PaintEventHandler(PnlInd_Paint);
pnlInd[i].Resize += new EventHandler(PnlInd_Resize);
pnlInd[i].MouseMove += new MouseEventHandler(SepChart_MouseMove);
pnlInd[i].MouseLeave += new EventHandler(SepChart_MouseLeave);
pnlInd[i].MouseDown += new MouseEventHandler(Panel_MouseDown);
pnlInd[i].MouseUp += new MouseEventHandler(Panel_MouseUp);
}
int iIndex = 0;
for (int iSlot = 0; iSlot < Data.Strategy.Slots; iSlot++)
{
if (!Data.Strategy.Slot[iSlot].SeparatedChart) continue;
pnlInd[iIndex].Tag = iSlot;
iIndex++;
}
for (int i = 0; i < indPanels && isIndicatorsShown; i++)
{
splitterInd[i].Parent = pnlCharts;
pnlInd[i].Parent = pnlCharts;
}
// Balance chart
spliterBalance = new Splitter();
spliterBalance.BorderStyle = BorderStyle.None;
spliterBalance.Dock = DockStyle.Bottom;
spliterBalance.Height = 2;
pnlBalanceChart = new Panel();
pnlBalanceChart.Dock = DockStyle.Bottom;
pnlBalanceChart.BackColor = LayoutColors.ColorChartBack;
pnlBalanceChart.Paint += new PaintEventHandler(PnlBalance_Paint);
pnlBalanceChart.Resize += new EventHandler(PnlBalance_Resize);
pnlBalanceChart.MouseMove += new MouseEventHandler(SepChart_MouseMove);
pnlBalanceChart.MouseLeave += new EventHandler(SepChart_MouseLeave);
pnlBalanceChart.MouseDown += new MouseEventHandler(Panel_MouseDown);
pnlBalanceChart.MouseUp += new MouseEventHandler(Panel_MouseUp);
if (isBalanceEquityShown)
{
spliterBalance.Parent = pnlCharts;
pnlBalanceChart.Parent = pnlCharts;
}
// Floating Profit Loss chart
spliterFloatingPL = new Splitter();
spliterFloatingPL.BorderStyle = BorderStyle.None;
spliterFloatingPL.Dock = DockStyle.Bottom;
spliterFloatingPL.Height = 2;
pnlFloatingPLChart = new Panel();
pnlFloatingPLChart.Dock = DockStyle.Bottom;
pnlFloatingPLChart.BackColor = LayoutColors.ColorChartBack;
pnlFloatingPLChart.Paint += new PaintEventHandler(PnlFloatingPL_Paint);
pnlFloatingPLChart.Resize += new EventHandler(PnlFloatingPL_Resize);
pnlFloatingPLChart.MouseMove += new MouseEventHandler(SepChart_MouseMove);
pnlFloatingPLChart.MouseLeave += new EventHandler(SepChart_MouseLeave);
pnlFloatingPLChart.MouseDown += new MouseEventHandler(Panel_MouseDown);
pnlFloatingPLChart.MouseUp += new MouseEventHandler(Panel_MouseUp);
if (isFloatingPLShown)
{
spliterFloatingPL.Parent = pnlCharts;
pnlFloatingPLChart.Parent = pnlCharts;
}
scroll = new HScrollBar();
scroll.Parent = pnlCharts;
scroll.Dock = DockStyle.Bottom;
scroll.TabStop = true;
scroll.Minimum = Data.FirstBar;
scroll.Maximum = Data.Bars - 1;
scroll.SmallChange = 1;
scroll.ValueChanged += new EventHandler(Scroll_ValueChanged);
scroll.MouseWheel += new MouseEventHandler(Scroll_MouseWheel);
scroll.KeyUp += new KeyEventHandler(Scroll_KeyUp);
scroll.KeyDown += new KeyEventHandler(Scroll_KeyDown);
mouseTips = new ToolTip();
mouseTips.IsBalloon = true;
mouseTips.BackColor = LayoutColors.ColorControlBack;
mouseTips.ForeColor = LayoutColors.ColorControlText;
mouseTips.AutomaticDelay = 0;
mouseTips.ReshowDelay = 0;
mouseTips.UseFading = true;
return;
}