NinjaScript > Language Reference > Strategy > TradeCollection > TradesPerformance >
AvgTradeDuration
Definition Returns the average duration of a trade weighted by quantity.
Property Value
A TimeSpan value that represents the quantity-weighted average duration of a trade.
Syntax <TradeCollection>.TradesPerformance.AvgTradeDuration
Examples
protected override void OnBarUpdate() { // Print out the quantity-weighted average duration of all trades
Print("Average trade duration: " + Performance.AllTrades.TradesPerformance.AvgTradeDuration); }