ChartArea.DrawIcon
method · ChartArea · cAlgo.API
DesktopCLICloud
Draws an icon.
Environment behaviour
CLI — works differently. The object is created and returned, but never drawn: the CLI displays no chart.
Cloud — works differently. The object is created and returned, but never drawn: the cloud displays no chart.
Overloads
| Signature |
|---|
DrawIcon(string name, ChartIconType iconType, DateTime time, double y, Color color) |
DrawIcon(string name, ChartIconType iconType, int barIndex, double y, Color color) |
DrawIcon(string name, ChartIconType iconType, DateTime time, double y, Color color)
Draws an icon.
ChartIcon DrawIcon(string name, ChartIconType iconType, DateTime time, double y, Color color)
chartArea.DrawIcon(name: str, iconType: ChartIconType, time: DateTime, y: float, color: Color) -> ChartIcon
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
name | string | str | The chart object name - a unique name that can be only used once for a chart area. If duplicated, the chart object will be replaced with a new one of the same name. |
iconType | ChartIconType | ChartIconType | The type of the icon. |
time | DateTime | DateTime | The time value of the icon location on the X-axis. |
y | double | float | The Y-axis value of the icon location. |
color | Color | Color | The color of the icon. |
Returns ChartIcon — ChartIcon.
Examples
var icon = Chart.DrawIcon("buySignal", ChartIconType.UpArrow, Bars.OpenTimes.LastValue, Bars.LowPrices.LastValue, Color.Green);
Print("Icon drawn at {0}", icon.Time);
icon = api.Chart.DrawIcon("buySignal", ChartIconType.UpArrow, api.Bars.OpenTimes.LastValue, api.Bars.LowPrices.LastValue, Color.Green)
api.Print(f"Icon drawn at {icon.Time}")
DrawIcon(string name, ChartIconType iconType, int barIndex, double y, Color color)
Draws an icon.
ChartIcon DrawIcon(string name, ChartIconType iconType, int barIndex, double y, Color color)
chartArea.DrawIcon(name: str, iconType: ChartIconType, barIndex: int, y: float, color: Color) -> ChartIcon
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
name | string | str | The chart object name - a unique name that can be only used once for a chart area. If duplicated, the chart object will be replaced with a new one of the same name. |
iconType | ChartIconType | ChartIconType | Type of the icon. |
barIndex | int | int | The bar index of the icon location on the X-axis. |
y | double | float | The Y-axis value of the icon location. |
color | Color | Color | The color of the icon. |
Returns ChartIcon — ChartIcon.
Examples
// Draw an icon on the last bar high.
var index = Bars.Count - 1;
var icon = Chart.DrawIcon("highIcon", ChartIconType.Star, index, Bars.HighPrices[index], Color.Gold);
Print("Icon drawn at {0}", icon.Y);
index = api.Bars.Count - 1
icon = api.Chart.DrawIcon("highIcon", ChartIconType.Star, index, api.Bars.HighPrices[index], Color.Gold)
api.Print(f"Icon drawn at {icon.Y}")