Overall Statistics
Total Trades
4
Average Win
0.01%
Average Loss
-4.16%
Compounding Annual Return
-3.679%
Drawdown
15.000%
Expectancy
-0.499
Net Profit
-1.519%
Sharpe Ratio
-0.048
Loss Rate
50%
Win Rate
50%
Profit-Loss Ratio
0.00
Alpha
-0.171
Beta
1.411
Annual Standard Deviation
0.204
Annual Variance
0.042
Information Ratio
-0.904
Tracking Error
0.137
Treynor Ratio
-0.007
Total Fees
$43.03
namespace QuantConnect 
{   
    /*
    *   Basic Template Algorithm
    *
    *   The underlying QCAlgorithm class has many methods which enable you to use QuantConnect.
    *   We have explained some of these here, but the full base class can be found at:
    *   https://github.com/QuantConnect/Lean/tree/master/Algorithm
    */
    public class BasicTemplateAlgorithm : QCAlgorithm
    {
        public int counter = 0;
        
        public override void Initialize() 
        {
        	// backtest parameters
            SetStartDate(2016, 5, 5);         
            SetEndDate(2016, 10, 2);
            
            // cash allocation
            SetCash(100000);
            
            // request specific equities
            // including forex. Options and futures in beta.
            AddEquity("GOOG", Resolution.Daily);
            AddEquity("GS", Resolution.Daily);
            AddEquity("MS", Resolution.Daily);
            //AddForex("EURUSD", Resolution.Minute);
        }

        public override void OnData(Slice data) 
        {
        	// slice has lots of useful information
        	TradeBars bars = data.Bars;
        	Splits splits = data.Splits;
        	Dividends dividends = data.Dividends;
        	if(counter == 1)
        	{
        		SetHoldings("GS", 1);
        		SetHoldings("MS", -1);
        	}
            if (counter == 10) 
            {
                Liquidate("MS");
                SetHoldings("GS", 1);
                SetHoldings("GOOG", -1);

            }
            counter = counter + 1;
        }
    }
}