Overall Statistics |
Total Trades 611 Average Win 0.00% Average Loss 0.00% Compounding Annual Return 0.946% Drawdown 0.300% Expectancy 4.536 Net Profit 0.946% Sharpe Ratio 1.659 Loss Rate 23% Win Rate 77% Profit-Loss Ratio 6.20 Alpha 0.008 Beta 0.023 Annual Standard Deviation 0.005 Annual Variance 0 Information Ratio 0.029 Tracking Error 0.139 Treynor Ratio 0.335 Total Fees $611.02 |
namespace QuantConnect { public class FUB_MissingTrades : QCAlgorithm { List<string> _symbols = new List<string>() {"AAPL", "AMZN" , "NFLX", "TSLA"}; //---------------------------------------------------------------------- // Initialize the data and resolution you require for your strategy: public override void Initialize() { SetStartDate(2015, 1, 1); SetEndDate(2015, 12, 31); SetCash(2e6); foreach(var symbol in _symbols) { AddSecurity(SecurityType.Equity, symbol, Resolution.Daily); //Chart - Master Container for the Chart: var stockPlot = new Chart(symbol + " trade plot"); //On the Trade Plotter Chart we want 3 series: trades and price: var buyOrders = new Series("Buy", SeriesType.Scatter, 0); var sellOrders = new Series("Sell", SeriesType.Scatter, 0); stockPlot.AddSeries(buyOrders); stockPlot.AddSeries(sellOrders); AddChart(stockPlot); } } //---------------------------------------------------------------------- // Data Event Handler: New data arrives here. public void OnData(TradeBars data) { foreach(var bar in data.Values) { // adjust investment to $10k var netValue = Portfolio[bar.Symbol].Quantity * Portfolio[bar.Symbol].Price; int deltaShares = (int)Math.Floor((10000 - netValue) / Portfolio[bar.Symbol].Price); if (deltaShares != 0) { var newTicket = MarketOnOpenOrder(bar.Symbol, deltaShares); } } } public override void OnOrderEvent(OrderEvent orderEvent) { if(orderEvent.Status == OrderStatus.Filled) { var chartName = orderEvent.Symbol + " trade plot"; if(orderEvent.FillQuantity > 0) Plot(chartName, "Buy", orderEvent.FillPrice); else Plot(chartName, "Sell", orderEvent.FillPrice); } } } }