| Overall Statistics |
|
Total Trades 1 Average Win 0% Average Loss 0% Compounding Annual Return -100.000% Drawdown 8.500% Expectancy 0 Net Profit -7.139% Sharpe Ratio -6.928 Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 1.831 Beta 25.94 Annual Standard Deviation 0.851 Annual Variance 0.724 Information Ratio -6.837 Tracking Error 0.819 Treynor Ratio -0.227 Total Fees $4.89 |
namespace QuantConnect
{
/*
* Test members of data
*
* SPY not found in data if daily and minute data
* are mixed
*/
public class BasicTemplateAlgorithm : QCAlgorithm
{
public override void Initialize()
{
// backtest parameters
SetStartDate(2017, 8, 22);
SetEndDate(2017, 8, 23);
// cash allocation
SetCash(25000);
// request specific equities
// including forex. Options and futures in beta.
AddEquity("VXX", Resolution.Daily);
UniverseSettings.Resolution = Resolution.Minute;
AddUniverse(Universe.DollarVolume.Top(5));
}
/*
* New data arrives here.
* The "Slice" data represents a slice of time, it has all the data you need for a moment.
*/
public void OnData(TradeBars data)
{
int i=0;
decimal orderSize = 0;
decimal tradeCashAllocation= 6000;
orderSize = Math.Floor(tradeCashAllocation / Securities["VXX"].Price);
Debug("Buy x " + Time.Date.ToShortDateString() + " orderSize=" + orderSize + " Portfolio.Cash=" + Portfolio.Cash ) ;
//MarketTicket = StopMarketOrder(Stock.Symbol, orderSize, price * 0.97m); // 0.95m);
if (! Portfolio.Invested)
SetHoldings("VXX", orderSize);
}
}
}