Overall Statistics
Total Trades
7754
Average Win
0.17%
Average Loss
-0.25%
Compounding Annual Return
6.281%
Drawdown
19.100%
Expectancy
0.031
Net Profit
32.158%
Sharpe Ratio
0.629
Loss Rate
38%
Win Rate
62%
Profit-Loss Ratio
0.66
Alpha
-0.049
Beta
5.794
Annual Standard Deviation
0.106
Annual Variance
0.011
Information Ratio
0.44
Tracking Error
0.106
Treynor Ratio
0.012
Total Fees
$16661.38
namespace QuantConnect.Algorithm.CSharp
{
    public class TachyonQuantumComputer : QCAlgorithm
    {
		private Security _sec;
		private AverageDirectionalIndex _adx;
		private SimpleMovingAverage _ma20;
		private RelativeStrengthIndex _rsi2;

        public override void Initialize()
        {
            SetStartDate(2014, 11, 1);  //Set Start Date
            SetCash(100000);             //Set Strategy Cash
            
            _sec = AddEquity("TSLA", Resolution.Minute);
			var symbol = _sec.Symbol;

			_adx = ADX(symbol, 14);
			_ma20 = SMA(symbol, 20);
			_rsi2 = RSI(symbol, 2);
        }

        /// OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
        /// Slice object keyed by symbol containing the stock data
        public override void OnData(Slice data)
        {
        	var diPlus = _adx.PositiveDirectionalIndex;
        	var diMinus = _adx.NegativeDirectionalIndex;
        	var price = _sec.Price;
        	
        	bool buy = _adx > 30 && price > _ma20 && diPlus > diMinus && _rsi2 < 25;
        	bool sell = _rsi2 > 75;
        	
        	if (sell)
        	{
        		if (Portfolio.Invested)
	            {
					SetHoldings(_sec.Symbol, 0);
            	}
        	}
        	else if (buy && !sell)
        	{
	        	if (!Portfolio.Invested)
	            {
					SetHoldings(_sec.Symbol, 1);
            	}
        	}
        }

    }
}