Overall Statistics
Total Trades
1
Average Win
0%
Average Loss
0%
Compounding Annual Return
3.920%
Drawdown
34.300%
Expectancy
0
Net Profit
4.085%
Sharpe Ratio
0.296
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0.211
Beta
-4.541
Annual Standard Deviation
0.406
Annual Variance
0.165
Information Ratio
0.248
Tracking Error
0.406
Treynor Ratio
-0.027
Total Fees
$1.00
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
    {
    	const string stock = "TSLA";
    	
        public override void Initialize() 
        {
        	// backtest parameters
            SetStartDate(2017, 6, 1);         
            // SetEndDate(DateTime.Now);
            
            // cash allocation
            SetCash(10000);
            
            // request specific equities
            // including forex. Options and futures in beta.
            AddEquity(stock, Resolution.Daily);
            //AddForex("EURUSD", Resolution.Minute);
            

        }

        /* 
        *	New data arrives here.
        *	The "Slice" data represents a slice of time, it has all the data you need for a moment.	
        */ 
        public override void OnData(Slice data) 
        {
        	// slice has lots of useful information
        	TradeBars bars = data.Bars;
        	Splits splits = data.Splits;
        	Dividends dividends = data.Dividends;
        	
        	//Get just this bar.
        	TradeBar bar;
        	if (bars.ContainsKey(stock)) bar = bars[stock];
        	
            if (!Portfolio.HoldStock) 
            {
                // place an order, positive is long, negative is short.
                // Order("SPY",  quantity);
                
                // or request a fixed fraction of a specific asset. 
                // +1 = 100% long. -2 = short all capital with 2x leverage.
                SetHoldings(stock, 1);
                
                // debug message to your console. Time is the algorithm time.
                // send longer messages to a file - these are capped to 10kb
                Debug("Purchased stock on " + Time.ToShortDateString());
                //Log("This is a longer message send to log.");
            }
        }
    }
}