Overall Statistics |
Total Trades 1 Average Win 0% Average Loss 0% Compounding Annual Return -13.307% Drawdown 1.700% Expectancy 0 Net Profit -1.244% Sharpe Ratio -5.95 Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha -0.243 Beta 5.509 Annual Standard Deviation 0.023 Annual Variance 0.001 Information Ratio -6.828 Tracking Error 0.023 Treynor Ratio -0.025 Total Fees $1.00 |
using QuantConnect.Data.Market; using QuantConnect.Orders; namespace QuantConnect.Algorithm.CSharp.PrimatLab { public class Issue1 : QCAlgorithm { private OrderTicket _orderEntry = null; private OrderTicket _orderStopLoss = null; private OrderTicket _orderStopLoss2 = null; public override void Initialize() { SetStartDate(2018, 1, 1); SetEndDate(2018, 2, 1); SetCash(100000); AddEquity("SPY", Resolution.Daily); } public void OnData(TradeBars data) { foreach (var symbol in data.Keys) { Debug(data[symbol].Time + " : " + data[symbol].Close); if (_orderEntry == null) { _orderEntry = MarketOrder(symbol, -100, false, "Entry"); //_orderStopLoss2 = StopMarketOrder(symbol, 100, 278.0m, "StopLoss2"); } } } public override void OnOrderEvent(OrderEvent orderEvent) { var order = Transactions.GetOrderById(orderEvent.OrderId); if (order.Tag == "Entry" && orderEvent.Status == OrderStatus.Filled) { Debug("Enter short at " + orderEvent.FillPrice + " set STOPLOSS at 275"); _orderStopLoss = StopMarketOrder(order.Symbol, order.Quantity, 275.0m, "StopLoss"); } if (order.Tag != "Entry") Debug(order.Tag + " " + order.Status.ToString()); } } }