Skip to content

ChartFibonacciRetracement.CalculateY

method · ChartFibonacciRetracement · 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)
chartFibonacciRetracement.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 retracement = Chart.DrawFibonacciRetracement("retracement", Bars.OpenTimes.Last(50), Bars.HighPrices.Last(50), Bars.OpenTimes.Last(10), Bars.LowPrices.Last(10), Color.Red);
Print("Retracement value at the last bar: {0}", retracement.CalculateY(Bars.Count - 1));
retracement = api.Chart.DrawFibonacciRetracement("retracement", api.Bars.OpenTimes.Last(50), api.Bars.HighPrices.Last(50), api.Bars.OpenTimes.Last(10), api.Bars.LowPrices.Last(10), Color.Red)
api.Print(f"Retracement value at the last bar: {retracement.CalculateY(api.Bars.Count - 1)}")

CalculateY(DateTime time)

Calculates Y-axis value corresponding the specified time value.

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

Parameters

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

Returns double — Y-axis value

Examples

var retracement = Chart.DrawFibonacciRetracement("retracement", Bars.OpenTimes.Last(50), Bars.HighPrices.Last(50), Bars.OpenTimes.Last(10), Bars.LowPrices.Last(10), Color.Red);
Print("Retracement value at {0}: {1}", Bars.OpenTimes.Last(20), retracement.CalculateY(Bars.OpenTimes.Last(20)));
retracement = api.Chart.DrawFibonacciRetracement("retracement", api.Bars.OpenTimes.Last(50), api.Bars.HighPrices.Last(50), api.Bars.OpenTimes.Last(10), api.Bars.LowPrices.Last(10), Color.Red)
api.Print(f"Retracement value at {api.Bars.OpenTimes.Last(20)}: {retracement.CalculateY(api.Bars.OpenTimes.Last(20))}")