TimeFrame.Parse
method · TimeFrame · cAlgo.API
DesktopCLICloud
It parses a string and if it matched to a timeframe name it returns that time frame otherwise it throws FormatException
Definition
public static TimeFrame Parse(string value)
TimeFrame.Parse(value: str) -> TimeFrame
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
value | string | str | Timeframe name |
Returns TimeFrame — TimeFrame
Examples
var timeFrame = TimeFrame.Parse("Hour4");
var bars = MarketData.GetBars(timeFrame);
Print("{0} bars loaded: {1}", timeFrame.ShortName, bars.Count);
timeFrame = TimeFrame.Parse("Hour4")
bars = api.MarketData.GetBars(timeFrame)
api.Print(f"{timeFrame.ShortName} bars loaded: {bars.Count}")