| Overall Statistics |
|
Total Trades 33 Average Win 7.84% Average Loss -5.50% Compounding Annual Return -99.986% Drawdown 44.200% Expectancy -0.545 Net Profit -41.368% Sharpe Ratio -5.666 Loss Rate 81% Win Rate 19% Profit-Loss Ratio 1.43 Alpha -6.047 Beta -0.135 Annual Standard Deviation 1.071 Annual Variance 1.146 Information Ratio -5.773 Tracking Error 1.075 Treynor Ratio 44.774 Total Fees $1147.82 |
using QuantConnect.Scheduling;
namespace QuantConnect
{
public class CatchingTheBottom : QCAlgorithm
{
public override void Initialize()
{
SetStartDate(2016, 4, 1);
SetEndDate(DateTime.Now.Date.AddDays(-1));
SetCash(25000);
AddSecurity(SecurityType.Equity, "DUST", Resolution.Second);
AddSecurity(SecurityType.Equity, "NUGT", Resolution.Second);
//Close all positions by end of day
Schedule.On(DateRules.EveryDay("DUST"), TimeRules.BeforeMarketClose("DUST", .1), () =>
{
Liquidate();
});
}
//Data Event Handler: New data arrives here. "TradeBars" type is a dictionary of strings so you can access it by symbol.
public void OnData(TradeBars data)
{
if (!Portfolio.HoldStock)
{
int quantity = (int)Math.Floor(Portfolio.Cash / data["DUST"].Close);
Order("DUST", quantity);
Debug("Purchased DUST on " + Time.ToShortDateString());
}
}
}
}