Overall Statistics |
Total Trades 2 Average Win 8.91% Average Loss -2.93% Compounding Annual Return 5.729% Drawdown 4.500% Expectancy 1.022 Net Profit 5.724% Sharpe Ratio 0.835 Loss Rate 50% Win Rate 50% Profit-Loss Ratio 3.04 Alpha 0.047 Beta 0.081 Annual Standard Deviation 0.069 Annual Variance 0.005 Information Ratio -0.6 Tracking Error 0.124 Treynor Ratio 0.711 Total Fees $5.18 |
using System; using System.Collections; using System.Collections.Generic; using QuantConnect.Securities; using QuantConnect.Models; namespace QuantConnect { // Name your algorithm class anything, as long as it inherits QCAlgorithm public class pair_trading_Algorithm : QCAlgorithm { //Initialize the data and resolution you require for your strategy: public override void Initialize() { // Code Automaticly Generated AddSecurity(SecurityType.Equity, "KO", Resolution.Minute); // Code Automaticly Generated AddSecurity(SecurityType.Equity, "PEP", Resolution.Minute); // Code Automaticly Generated // Code Automaticly Generated SetStartDate(2014, 1, 1); SetEndDate(2015,1,1); SetCash(25000); // AddSecurity(SecurityType.Equity, "MSFT", Resolution.Minute); } //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) { Order("KO", -(int)Math.Floor(12500 / data["KO"].Close)); Order("PEP",(int)Math.Floor(12500 / data["PEP"].Close)); // Debug("Debug Purchased MSFT"); } } } }