ChartFibonacciFan.CalculateY
method · ChartFibonacciFan · 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, FibonacciLevel level) | Calculates Y-axis value corresponding the specified bar index. |
CalculateY(DateTime time, FibonacciLevel level) | Calculates Y-axis value corresponding the specified time value. |
CalculateY(int barIndex, FibonacciLevel level)
Calculates Y-axis value corresponding the specified bar index.
double CalculateY(int barIndex, FibonacciLevel level)
chartFibonacciFan.CalculateY(barIndex: int, level: FibonacciLevel) -> float
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
barIndex | int | int | Index of the bar. |
level | FibonacciLevel | FibonacciLevel | Level to get Y-axis value for. |
Returns double — Y-axis value
Examples
var fan = Chart.DrawFibonacciFan("fan", Bars.OpenTimes.Last(30), Bars.LowPrices.Last(30), Bars.OpenTimes.Last(10), Bars.HighPrices.Last(10), Color.Red);
foreach (var level in fan.FibonacciLevels)
Print("Level {0}% value at the last bar: {1}", level.Percent, fan.CalculateY(Bars.Count - 1, level));
fan = api.Chart.DrawFibonacciFan("fan", api.Bars.OpenTimes.Last(30), api.Bars.LowPrices.Last(30), api.Bars.OpenTimes.Last(10), api.Bars.HighPrices.Last(10), Color.Red)
for level in fan.FibonacciLevels:
api.Print(f"Level {level.Percent}% value at the last bar: {fan.CalculateY(api.Bars.Count - 1, level)}")
CalculateY(DateTime time, FibonacciLevel level)
Calculates Y-axis value corresponding the specified time value.
double CalculateY(DateTime time, FibonacciLevel level)
chartFibonacciFan.CalculateY(time: DateTime, level: FibonacciLevel) -> float
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
time | DateTime | DateTime | The time. |
level | FibonacciLevel | FibonacciLevel | Level to get Y-axis value for. |
Returns double — Y-axis value
Examples
var fan = Chart.DrawFibonacciFan("fan", Bars.OpenTimes.Last(30), Bars.LowPrices.Last(30), Bars.OpenTimes.Last(10), Bars.HighPrices.Last(10), Color.Red);
var level = fan.FibonacciLevels[0];
Print("Level {0}% value at {1}: {2}", level.Percent, Bars.OpenTimes.LastValue, fan.CalculateY(Bars.OpenTimes.LastValue, level));
fan = api.Chart.DrawFibonacciFan("fan", api.Bars.OpenTimes.Last(30), api.Bars.LowPrices.Last(30), api.Bars.OpenTimes.Last(10), api.Bars.HighPrices.Last(10), Color.Red)
level = fan.FibonacciLevels[0]
api.Print(f"Level {level.Percent}% value at {api.Bars.OpenTimes.LastValue}: {fan.CalculateY(api.Bars.OpenTimes.LastValue, level)}")