ChartArea.AddControl
method · ChartArea · cAlgo.API
Adds a chart control from the Control Base to the main chart area or to the indicator area.
Environment behaviour
CLI — not supported. The control is accepted but never displayed: the CLI displays no chart.
Cloud — not supported. The control is accepted but never displayed: the cloud displays no chart.
Overloads
| Signature | Description |
|---|---|
AddControl(ControlBase control) | Adds a chart control from the Control Base to the main chart area or to the indicator area. |
AddControl(ControlBase control, int barIndex, double y) | Adds a chart control to chart / indicator area on absolute bar index and price (x,y) coordinates. |
AddControl(ControlBase control, DateTime time, double y) | Adds a chart control to chart / indicator area on absolute time and price (x,y) coordinates. |
AddControl(ControlBase control, DateTime time) | Adds a chart control to chart / indicator area on absolute time (x) coordinate. |
AddControl(ControlBase control, int barIndex) | Adds a chart control to chart / indicator area on absolute bar index (x) coordinate. |
AddControl(ControlBase control, double y) | Adds a chart control to chart / indicator area on absolute price (y) coordinate. |
AddControl(ControlBase control)
Adds a chart control from the Control Base to the main chart area or to the indicator area.
void AddControl(ControlBase control)
chartArea.AddControl(control: ControlBase) -> None
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
control | ControlBase | ControlBase | The control that will be added |
Examples
var button = new Button { Text = "Buy", HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Top };
button.Click += args => ExecuteMarketOrder(TradeType.Buy, SymbolName, Symbol.VolumeInUnitsMin);
Chart.AddControl(button);
button = Button()
button.Text = "Buy"
button.HorizontalAlignment = HorizontalAlignment.Right
button.VerticalAlignment = VerticalAlignment.Top
button.Click += lambda args: api.ExecuteMarketOrder(TradeType.Buy, api.SymbolName, api.Symbol.VolumeInUnitsMin)
api.Chart.AddControl(button)
AddControl(ControlBase control, int barIndex, double y)
Adds a chart control to chart / indicator area on absolute bar index and price (x,y) coordinates.
void AddControl(ControlBase control, int barIndex, double y)
chartArea.AddControl(control: ControlBase, barIndex: int, y: float) -> None
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
control | ControlBase | ControlBase | The control that will be added |
barIndex | int | int | Bar Index |
y | double | float | Price |
Examples
var label = new TextBlock { Text = "High", ForegroundColor = Color.Yellow };
Chart.AddControl(label, Bars.Count - 1, Bars.HighPrices.LastValue);
label = TextBlock()
label.Text = "High"
label.ForegroundColor = Color.Yellow
api.Chart.AddControl(label, api.Bars.Count - 1, api.Bars.HighPrices.LastValue)
AddControl(ControlBase control, DateTime time, double y)
Adds a chart control to chart / indicator area on absolute time and price (x,y) coordinates.
void AddControl(ControlBase control, DateTime time, double y)
chartArea.AddControl(control: ControlBase, time: DateTime, y: float) -> None
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
control | ControlBase | ControlBase | The control that will be added |
time | DateTime | DateTime | Time |
y | double | float | Price |
Examples
var label = new TextBlock { Text = "Low", ForegroundColor = Color.Orange };
Chart.AddControl(label, Bars.OpenTimes.LastValue, Bars.LowPrices.LastValue);
label = TextBlock()
label.Text = "Low"
label.ForegroundColor = Color.Orange
api.Chart.AddControl(label, api.Bars.OpenTimes.LastValue, api.Bars.LowPrices.LastValue)
AddControl(ControlBase control, DateTime time)
Adds a chart control to chart / indicator area on absolute time (x) coordinate.
void AddControl(ControlBase control, DateTime time)
chartArea.AddControl(control: ControlBase, time: DateTime) -> None
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
control | ControlBase | ControlBase | The control that will be added |
time | DateTime | DateTime | Time |
Examples
var label = new TextBlock { Text = "Session open", VerticalAlignment = VerticalAlignment.Top };
Chart.AddControl(label, Server.Time.Date);
label = TextBlock()
label.Text = "Session open"
label.VerticalAlignment = VerticalAlignment.Top
api.Chart.AddControl(label, api.Server.Time.Date)
AddControl(ControlBase control, int barIndex)
Adds a chart control to chart / indicator area on absolute bar index (x) coordinate.
void AddControl(ControlBase control, int barIndex)
chartArea.AddControl(control: ControlBase, barIndex: int) -> None
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
control | ControlBase | ControlBase | The control that will be added |
barIndex | int | int | Bar Index |
Examples
var label = new TextBlock { Text = "Last bar", VerticalAlignment = VerticalAlignment.Bottom };
Chart.AddControl(label, Bars.Count - 1);
label = TextBlock()
label.Text = "Last bar"
label.VerticalAlignment = VerticalAlignment.Bottom
api.Chart.AddControl(label, api.Bars.Count - 1)
AddControl(ControlBase control, double y)
Adds a chart control to chart / indicator area on absolute price (y) coordinate.
void AddControl(ControlBase control, double y)
chartArea.AddControl(control: ControlBase, y: float) -> None
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
control | ControlBase | ControlBase | The control that will be added |
y | double | float | Price |
Examples
var label = new TextBlock { Text = "Bid", HorizontalAlignment = HorizontalAlignment.Right };
Chart.AddControl(label, Symbol.Bid);
label = TextBlock()
label.Text = "Bid"
label.HorizontalAlignment = HorizontalAlignment.Right
api.Chart.AddControl(label, api.Symbol.Bid)