Skip to content

ChartFrame.TryChangeTimeFrame

method · ChartFrame · cAlgo.API

DesktopCLICloud

Changes the time frame on the chart.

Environment behaviour

CLI — not supported. Available to plugins only, and plugins cannot run in the CLI.

Cloud — not supported. Available to plugins only, and plugins cannot run in the cloud.

Definition

bool TryChangeTimeFrame(TimeFrame timeFrame)
chartFrame.TryChangeTimeFrame(timeFrame: TimeFrame) -> bool

Parameters

Name C# type Python type Description
timeFrame TimeFrame TimeFrame The time frame to change the current chart time frame to

Returns bool — True if successful otherwise false.

Examples

var chartFrame = ChartManager.AddChartFrame("EURUSD", TimeFrame.Hour);
var isChanged = chartFrame.TryChangeTimeFrame(TimeFrame.Daily);
Print("Time frame changed: {0}", isChanged);
chartFrame = api.ChartManager.AddChartFrame("EURUSD", TimeFrame.Hour)
isChanged = chartFrame.TryChangeTimeFrame(TimeFrame.Daily)
api.Print(f"Time frame changed: {isChanged}")