ChartArrow.CalculateY
method · ChartArrow · cAlgo.API
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)
chartArrow.CalculateY(barIndex: int) -> float
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
barIndex | int | int | Index of the bar. |
Returns double — System.Double.
Examples
var arrow = Chart.DrawArrow("arrow", Bars.OpenTimes.Last(20), Bars.LowPrices.Last(20), Bars.OpenTimes.Last(10), Bars.HighPrices.Last(10), Color.Red);
arrow.ExtendToInfinity = true;
Print("Arrow value at the last bar: {0}", arrow.CalculateY(Bars.Count - 1));
arrow = api.Chart.DrawArrow("arrow", api.Bars.OpenTimes.Last(20), api.Bars.LowPrices.Last(20), api.Bars.OpenTimes.Last(10), api.Bars.HighPrices.Last(10), Color.Red)
arrow.ExtendToInfinity = True
api.Print(f"Arrow value at the last bar: {arrow.CalculateY(api.Bars.Count - 1)}")
CalculateY(DateTime time)
Calculates Y-axis value corresponding the specified time value.
double CalculateY(DateTime time)
chartArrow.CalculateY(time: DateTime) -> float
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
time | DateTime | DateTime | The time. |
Returns double — System.Double.
Examples
var arrow = Chart.DrawArrow("arrow", Bars.OpenTimes.Last(20), Bars.LowPrices.Last(20), Bars.OpenTimes.Last(10), Bars.HighPrices.Last(10), Color.Red);
arrow.ExtendToInfinity = true;
Print("Arrow value at {0}: {1}", Bars.OpenTimes.LastValue, arrow.CalculateY(Bars.OpenTimes.LastValue));
arrow = api.Chart.DrawArrow("arrow", api.Bars.OpenTimes.Last(20), api.Bars.LowPrices.Last(20), api.Bars.OpenTimes.Last(10), api.Bars.HighPrices.Last(10), Color.Red)
arrow.ExtendToInfinity = True
api.Print(f"Arrow value at {api.Bars.OpenTimes.LastValue}: {arrow.CalculateY(api.Bars.OpenTimes.LastValue)}")