Skip to content

Chart.SetBarFillColor

method · Chart · cAlgo.API

DesktopCLICloud

Sets the fill color of the bar at the specified bar index.

Environment behaviour

CLI — works differently. Applied to a chart that is never displayed in the CLI; no visual effect.

Cloud — not supported. Does nothing: the cloud host ignores bar colour changes.

Definition

void SetBarFillColor(long barIndex, Color color)
api.Chart.SetBarFillColor(barIndex: int, color: Color) -> None

Parameters

Name C# type Python type Description
barIndex long int The bar index number
color Color Color The color for filling the bar

Examples

var index = Bars.Count - 1;
if (Bars.TickVolumes[index] > Bars.TickVolumes[index - 1] * 2)
    Chart.SetBarFillColor(index, Color.Yellow);
index = api.Bars.Count - 1
if api.Bars.TickVolumes[index] > api.Bars.TickVolumes[index - 1] * 2:
    api.Chart.SetBarFillColor(index, Color.Yellow)