ChartArea.SetYRange
method · ChartArea · cAlgo.API
DesktopCLICloud
Sets the Y-axis lowest and highest values range. Allows scrolling the chart by the Y-axis. If only one of the values is set, then the chart will be expanded regarding the lowest or highest value respectively. A range whose lowest value is not lower than its highest value is ignored, and so is any range on the main chart area while the price scale mode is Percent or IndexedTo100.
Definition
void SetYRange(double bottomY, double topY)
chartArea.SetYRange(bottomY: float, topY: float) -> None
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
bottomY | double | float | The lowest visible Y-axis value. |
topY | double | float | The highest visible Y-axis value. |
Examples
var margin = 50 * Symbol.PipSize;
Chart.SetYRange(Bars.LowPrices.LastValue - margin, Bars.HighPrices.LastValue + margin);
Print("Visible Y range: {0} - {1}", Chart.BottomY, Chart.TopY);
margin = 50 * api.Symbol.PipSize
api.Chart.SetYRange(api.Bars.LowPrices.LastValue - margin, api.Bars.HighPrices.LastValue + margin)
api.Print(f"Visible Y range: {api.Chart.BottomY} - {api.Chart.TopY}")