Overall Statistics
Total Trades
1
Average Win
0%
Average Loss
0%
Compounding Annual Return
165.018%
Drawdown
0.900%
Expectancy
0
Net Profit
0%
Sharpe Ratio
85.185
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0
Beta
0
Annual Standard Deviation
0.007
Annual Variance
0
Information Ratio
0
Tracking Error
0
Treynor Ratio
0
Total Fees
$1.00
namespace QuantConnect 
{
    public class DailyRunningVolumeIndicator : QCAlgorithm
    {
    	DailyRunningVolume _runningVolume;
    	
        public override void Initialize() 
        {
            SetStartDate(2016, 1, 4);         
            SetEndDate(2016, 1, 5);
            SetCash(25000);
            AddSecurity(SecurityType.Equity, "SPY", Resolution.Minute);
            
            // create our volume indicator and register it to receive automatic data updates
            _runningVolume = new DailyRunningVolume("SPY Daily Running Volume");
            RegisterIndicator("SPY", _runningVolume);
            
            // plot our indicator so we can see it!
            PlotIndicator("SPY_Volume", _runningVolume);
        }
        
        public void OnData(TradeBars data) 
        {
        	if (!Portfolio.Invested)
        	{
        		SetHoldings("SPY", 1);
        	}
        }
    }
}
namespace QuantConnect
{

    /// <summary>
    /// Indicator that keeps track of the daily running volume
    /// </summary>
    public class DailyRunningVolume : TradeBarIndicator
    {
        private DateTime _date;
        private long _volume;

        /// <summary>
        /// Initializes a new instance of the <see cref="DailyRunningVolume"/> class
        /// </summary>
        public DailyRunningVolume()
            : base("DAILY_RUNNING_VOLUME")
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="DailyRunningVolume"/> class
        /// </summary>
        /// <param name="name">The name of this indicaor</param>
        public DailyRunningVolume(string name)
            : base(name)
        {
        }

        /// <summary>
        /// Gets a flag indicating when this indicator is ready and fully initialized
        /// </summary>
        public override bool IsReady
        {
            get { return true; }
        }

        /// <summary>
        /// Computes the next value of this indicator from the given state
        /// </summary>
        /// <param name="input">The input given to the indicator</param>
        /// <returns>A new value for this indicator</returns>
        protected override decimal ComputeNextValue(TradeBar input)
        {
            if (input.EndTime.Date != _date)
            {
                _volume = 0;
                _date = input.EndTime.Date;
            }

            _volume += input.Volume;
            return (decimal) _volume;
        }
    }
}