Overall Statistics
Total Trades
62
Average Win
1.62%
Average Loss
-0.94%
Compounding Annual Return
38.095%
Drawdown
3.300%
Expectancy
0.762
Net Profit
24.077%
Sharpe Ratio
2.302
Loss Rate
35%
Win Rate
65%
Profit-Loss Ratio
1.73
Alpha
0.299
Beta
-0.23
Annual Standard Deviation
0.117
Annual Variance
0.014
Information Ratio
1.001
Tracking Error
0.141
Treynor Ratio
-1.171
Total Fees
$62.34
namespace QuantConnect  {

    public class BasicTemplateAlgorithm : QCAlgorithm {
		string symbol = "AAPL";
		decimal minBuyChage = -0.01m;
		decimal minSellChage = 0.01m;
		decimal basePrice = 0;

        public override void Initialize()  {
			Debug("Initialize()");

			SetStartDate(new DateTime(2017, 1, 1));

			SetCash(25000);
			
			AddEquity(symbol, Resolution.Minute);
        }

        public void OnData(TradeBars bars)  {
        	if (!bars.ContainsKey(symbol)) {
        		return;
        	}
        	TradeBar bar = bars[symbol];
        	decimal price = bar.Close;
        	if (basePrice == 0) {
        		basePrice = price;
        	}
        	decimal change = (price - basePrice) / basePrice;
        	if (change < minBuyChage) {
        		SetHoldings(symbol, 1);
        		basePrice = price;
        	} else if (change > minSellChage) {
        		SetHoldings(symbol, 0);
        		basePrice = price;
        	}
        }

		public override void OnEndOfAlgorithm() {
			Debug("OnEndOfAlgorithm()");
		}

    }
}