Skip to content

ChartEquidistantChannel.CalculateY

method · ChartEquidistantChannel · cAlgo.API Since 5.8

DesktopCLICloud

Calculates Y-axis value corresponding the specified bar index.

Environment behaviour

CLI — works differently. Created and kept with all its properties, but never drawn: the CLI displays no chart.

Cloud — works differently. Created and kept with all its properties, but never drawn: the cloud displays no chart.

Overloads

Signature Description
CalculateY(int barIndex) Calculates Y-axis value corresponding the specified bar index.
CalculateY(DateTime time) Calculates Y-axis value corresponding the specified time value.

CalculateY(int barIndex)

Calculates Y-axis value corresponding the specified bar index.

double CalculateY(int barIndex)
chartEquidistantChannel.CalculateY(barIndex: int) -> float

Parameters

Name C# type Python type Description
barIndex int int Index of the bar.

Returns double — Y-axis value

Examples

var channel = Chart.DrawEquidistantChannel("channel", Bars.OpenTimes.Last(30), Bars.LowPrices.Last(30), Bars.OpenTimes.Last(10), Bars.LowPrices.Last(10), 20 * Symbol.PipSize, Color.Red);
channel.ExtendToInfinity = true;
Print("Channel base line at the last bar: {0}", channel.CalculateY(Bars.Count - 1));
channel = api.Chart.DrawEquidistantChannel("channel", api.Bars.OpenTimes.Last(30), api.Bars.LowPrices.Last(30), api.Bars.OpenTimes.Last(10), api.Bars.LowPrices.Last(10), 20 * api.Symbol.PipSize, Color.Red)
channel.ExtendToInfinity = True
api.Print(f"Channel base line at the last bar: {channel.CalculateY(api.Bars.Count - 1)}")

CalculateY(DateTime time)

Calculates Y-axis value corresponding the specified time value.

double CalculateY(DateTime time)
chartEquidistantChannel.CalculateY(time: DateTime) -> float

Parameters

Name C# type Python type Description
time DateTime DateTime The time.

Returns double — Y-axis value

Examples

var channel = Chart.DrawEquidistantChannel("channel", Bars.OpenTimes.Last(30), Bars.LowPrices.Last(30), Bars.OpenTimes.Last(10), Bars.LowPrices.Last(10), 20 * Symbol.PipSize, Color.Red);
channel.ExtendToInfinity = true;
var baseLine = channel.CalculateY(Bars.OpenTimes.LastValue);
Print("Channel base line: {0} | Upper line: {1}", baseLine, baseLine + channel.ChannelHeight);
channel = api.Chart.DrawEquidistantChannel("channel", api.Bars.OpenTimes.Last(30), api.Bars.LowPrices.Last(30), api.Bars.OpenTimes.Last(10), api.Bars.LowPrices.Last(10), 20 * api.Symbol.PipSize, Color.Red)
channel.ExtendToInfinity = True
baseLine = channel.CalculateY(api.Bars.OpenTimes.LastValue)
api.Print(f"Channel base line: {baseLine} | Upper line: {baseLine + channel.ChannelHeight}")