Overall Statistics |
Total Trades 11 Average Win 0.08% Average Loss 0% Compounding Annual Return 0.153% Drawdown 2.900% Expectancy 0 Net Profit 0.539% Sharpe Ratio 0.089 Probabilistic Sharpe Ratio 3.044% Loss Rate 0% Win Rate 100% Profit-Loss Ratio 0 Alpha 0.003 Beta -0.01 Annual Standard Deviation 0.016 Annual Variance 0 Information Ratio -0.768 Tracking Error 0.199 Treynor Ratio -0.139 Total Fees $11.00 Estimated Strategy Capacity $240000000.00 Lowest Capacity Asset IBM R735QTJ8XC9X |
using System.Collections.Generic; using QuantConnect.Data; using QuantConnect.Interfaces; namespace QuantConnect { public class VirtualApricotGalago : QCAlgorithm { private Symbol _symbol; private OrderTicket _limitTicket; private OrderTicket _stopLimitTicket; decimal TP1; decimal TP2; public override void Initialize() { SetStartDate(2017, 12, 1); SetCash(100000); _symbol = AddEquity( "IBM", Resolution.Daily).Symbol; } public override void OnOrderEvent(OrderEvent orderEvent){ if (orderEvent.Status == OrderStatus.Filled){ if(_limitTicket == null || orderEvent.OrderId != _limitTicket.OrderId){ return; } Debug("Sold at TP1"); var limitPrice = orderEvent.FillPrice * 1.01m; _stopLimitTicket = StopLimitOrder(_symbol, -50, orderEvent.FillPrice, limitPrice); } if(_stopLimitTicket != null && orderEvent.OrderId == _stopLimitTicket.OrderId) { Debug("Stop Limit order Executed"); } } public override void OnData(Slice data) { if (!Portfolio.Invested) { var close = Securities[_symbol].Close; MarketOrder(_symbol, 100); Debug("Purchased Stock"); _limitTicket = LimitOrder(_symbol, -50, close*1.01m); Debug("Limit order sent at TP1"); } } } }