Overall Statistics
Total Trades
533
Average Win
0.40%
Average Loss
-0.46%
Compounding Annual Return
-9.529%
Drawdown
33.700%
Expectancy
-0.036
Net Profit
-9.529%
Sharpe Ratio
-0.106
Loss Rate
48%
Win Rate
52%
Profit-Loss Ratio
0.87
Alpha
-0.016
Beta
-0.186
Annual Standard Deviation
0.309
Annual Variance
0.096
Information Ratio
-0.377
Tracking Error
0.332
Treynor Ratio
0.177
Total Fees
$533.00
namespace QuantConnect 
{   
    public class ConsolidatorAlgorithm : QCAlgorithm
    {
    	public string Symbol = "WFM";
    	public DateTime sampledToday = DateTime.Now;
    	public MoneyFlowIndex MFIFifteen;
    	MoneyFlowIndex mfidaily;

        //Initialize the data and resolution you require for your strategy:
        public override void Initialize() 
        {
            SetStartDate(2014, 01, 01);         
            SetEndDate(2015, 01, 01);
            SetCash(25000);
            AddSecurity(SecurityType.Equity, Symbol, Resolution.Minute);
            mfidaily = MFI(Symbol, 14, Resolution.Daily);

            var fifteenMinute = new TradeBarConsolidator(TimeSpan.FromMinutes(15));
            SubscriptionManager.AddConsolidator(Symbol, fifteenMinute);
            fifteenMinute.DataConsolidated += OnFifteenMinuteData;
            // define our 15 minute money flow indicator
            MFIFifteen = new MoneyFlowIndex(14);
            RegisterIndicator(Symbol, MFIFifteen, fifteenMinute);
        }
        
        // THis is 15 minute activities
        public void OnFifteenMinuteData(object sender, TradeBar bar)
        {

			if (MFIFifteen < 20)
			{
				Order(Symbol, 100);
				Debug("Below 20 mfi15 is " + MFIFifteen);
			}
 
            if (MFIFifteen > 80) 
            {
                Order(Symbol, -100);
                Debug("Above 80 mfi15 is "+ MFIFifteen);
           }
            
        }

		//THis is every one minute activities
        public void OnData(TradeBars data) 
        {
        	sampledToday = data[Symbol].Time;
        }
    }
}