Skip to content

ChartArea.ResetPriceScale

method · ChartArea · cAlgo.API Since 5.10

DesktopCLICloud

Resets the price scale of the chart area to its default state: enables the auto scale and fits the Y-axis range to the visible bars and outputs. Does not change the price scale mode, the inversion or the price axis position. Ignored on the main chart area while the price to bar ratio is locked. Does nothing in the silent backtesting, the CLI and the cloud.

Definition

void ResetPriceScale()
chartArea.ResetPriceScale() -> None

Examples

Chart.SetYRange(Chart.BottomY, Chart.TopY + Symbol.PipSize * 100);

Chart.ResetPriceScale();

Print("Auto scale after reset: {0} | Bottom Y: {1} | Top Y: {2}", Chart.IsAutoScaleEnabled, Chart.BottomY, Chart.TopY);
api.Chart.SetYRange(api.Chart.BottomY, api.Chart.TopY + api.Symbol.PipSize * 100)

api.Chart.ResetPriceScale()

print(f"Auto scale after reset: {api.Chart.IsAutoScaleEnabled} | Bottom Y: {api.Chart.BottomY} | Top Y: {api.Chart.TopY}")