Overall Statistics |
Total Trades 83 Average Win 0.41% Average Loss -0.63% Compounding Annual Return 18.940% Drawdown 2.400% Expectancy 0.251 Net Profit 5.927% Sharpe Ratio 2.094 Loss Rate 24% Win Rate 76% Profit-Loss Ratio 0.65 Alpha 0.236 Beta -0.174 Annual Standard Deviation 0.083 Annual Variance 0.007 Information Ratio -1.185 Tracking Error 0.154 Treynor Ratio -1 Total Fees $83.00 |
namespace QuantConnect { /* * Trying to liquidate from static class */ public class BasicTemplateAlgorithm : QCAlgorithm { //Initialize the data and resolution you require for your strategy: public override void Initialize() { //Start and End Date range for the backtest: SetStartDate(2013, 1, 1); SetEndDate(2013, 5, 1); //Cash allocation SetCash(25000); //Add as many securities as you like. All the data will be passed into the event handler: AddSecurity(SecurityType.Equity, "SPY", Resolution.Daily); } public void OnData(TradeBars data) { if (!Portfolio.HoldStock) { int quantity = (int)Math.Floor(Portfolio.Cash / data["SPY"].Close); Order("SPY", quantity); } else { RandomClass.TryToLiquidate(this, "SPY"); } } } public static class RandomClass { public static void TryToLiquidate(QCAlgorithm algorithm, string asset) { algorithm.Liquidate(asset); } } }