Overall Statistics
Total Trades
2702
Average Win
0.27%
Average Loss
-0.71%
Compounding Annual Return
3.423%
Drawdown
96.500%
Expectancy
0.125
Net Profit
65.923%
Sharpe Ratio
0.372
Probabilistic Sharpe Ratio
0.235%
Loss Rate
18%
Win Rate
82%
Profit-Loss Ratio
0.38
Alpha
0.216
Beta
-0.068
Annual Standard Deviation
0.565
Annual Variance
0.319
Information Ratio
0.208
Tracking Error
0.596
Treynor Ratio
-3.098
Total Fees
$2703.78
namespace QuantConnect 
{   
  
    public class SellHigh7s : QCAlgorithm
    {
    
    	RelativeStrengthIndex _rsi;
    	const string Symbol = "BA";
    
    	Variance _vari;
   
        public override void Initialize() 
        {
            SetStartDate(2005, 4, 15);         
            SetEndDate(DateTime.Now);
            //Minimum of 10,000 for this strategy to work. 
            SetCash(20000);
            AddEquity(Symbol, Resolution.Daily);
           

            _rsi = RSI(Symbol, 1, MovingAverageType.Simple , Resolution.Daily);
            
        }
        
        public override void OnData(Slice data) 
        {
        	var quantity = Portfolio[Symbol].Quantity;
        	
        	if (_rsi < 33  && quantity >= 0)
        	{
        		//Purchase 7 stocks here for every $50 that the stock is worth currently.
        		//Round up or down to the neaest increment of $50
        		Buy(Symbol, 27);
        		Debug("Purchased 27" + Symbol + "Shares");
        	}
        	
        	
        	else if (_rsi > 69 && quantity > 0)
        	{	
        		Sell(Symbol, 7);
        		Debug("Sold 7" + Symbol + "Shares");
        	}
        }
    }
}