ChartFrame.TryChangeTimeFrameAndSymbol
method · ChartFrame · cAlgo.API
DesktopCLICloud
Changes the time frame and the symbol 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 TryChangeTimeFrameAndSymbol(TimeFrame timeFrame, string symbolName)
chartFrame.TryChangeTimeFrameAndSymbol(timeFrame: TimeFrame, symbolName: str) -> bool
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
timeFrame | TimeFrame | TimeFrame | The time frame to change the current chart time frame to |
symbolName | string | str | The symbol name to change the current chart symbol to |
Returns bool — True if successful otherwise false.
Examples
var chartFrame = ChartManager.AddChartFrame("EURUSD", TimeFrame.Hour);
var isChanged = chartFrame.TryChangeTimeFrameAndSymbol(TimeFrame.Minute15, "GBPUSD");
Print("Chart changed: {0}", isChanged);
chartFrame = api.ChartManager.AddChartFrame("EURUSD", TimeFrame.Hour)
isChanged = chartFrame.TryChangeTimeFrameAndSymbol(TimeFrame.Minute15, "GBPUSD")
api.Print(f"Chart changed: {isChanged}")