IIndicatorsAccessor.TrueRange
method · IIndicatorsAccessor · cAlgo.API.Internals
DesktopCLICloud
Initializes the True Range indicator.
Overloads
| Signature |
|---|
TrueRange() |
TrueRange(Bars bars) |
TrueRange()
Initializes the True Range indicator.
TrueRange TrueRange()
api.Indicators.TrueRange() -> TrueRange
Returns TrueRange — True Range indicator instance
Examples
var trueRange = Indicators.TrueRange();
Print("True range of the last closed bar: {0}", trueRange.Result.Last(1));
trueRange = api.Indicators.TrueRange()
api.Print(f"True range of the last closed bar: {trueRange.Result.Last(1)}")
TrueRange(Bars bars)
Initializes the True Range indicator.
TrueRange TrueRange(Bars bars)
api.Indicators.TrueRange(bars: Bars) -> TrueRange
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
bars | Bars | Bars | The Bars that will be used by indicator, you can pass another timeframe/symbol bars |
Returns TrueRange — True Range indicator instance
Examples
var dailyBars = MarketData.GetBars(TimeFrame.Daily);
var dailyTrueRange = Indicators.TrueRange(dailyBars);
Print("True range of the last closed daily bar: {0}", dailyTrueRange.Result.Last(1));
dailyBars = api.MarketData.GetBars(TimeFrame.Daily)
dailyTrueRange = api.Indicators.TrueRange(dailyBars)
api.Print(f"True range of the last closed daily bar: {dailyTrueRange.Result.Last(1)}")