Skip to content

ChartRiskReward.VolumeInUnits

property · ChartRiskReward · cAlgo.API Since 5.2

DesktopCLICloud

Gets or sets the volume (in units).

Environment behaviour

CLI — works differently. Created and kept with all its properties, but never drawn: the CLI displays no chart.

Cloud — works differently. Created and kept with all its properties, but never drawn: the cloud displays no chart.

Definition

double VolumeInUnits {get; set;}
chartRiskReward.VolumeInUnits: float

Returns double

Examples

var riskReward = Chart.DrawRiskReward("rr", Bars.OpenTimes.Last(10), Bars.OpenTimes.LastValue, Symbol.Ask, OrderType.Market, TradeType.Buy, new ChartRiskRewardFixedRiskType(ChartRiskRewardAmountType.BalancePercentage, 1));
var volume = Symbol.NormalizeVolumeInUnits(riskReward.VolumeInUnits);
Print("Volume for a 1% risk: {0}", volume);
riskReward = api.Chart.DrawRiskReward("rr", api.Bars.OpenTimes.Last(10), api.Bars.OpenTimes.LastValue, api.Symbol.Ask, OrderType.Market, TradeType.Buy, ChartRiskRewardFixedRiskType(ChartRiskRewardAmountType.BalancePercentage, 1))
volume = api.Symbol.NormalizeVolumeInUnits(riskReward.VolumeInUnits)
api.Print(f"Volume for a 1% risk: {volume}")