Overall Statistics |
Total Trades 248 Average Win 0.58% Average Loss -0.03% Annual Return 22.082% Drawdown 33.100% Expectancy 7.572 Net Profit 66.287% Sharpe Ratio 0.684 Loss Rate 52% Win Rate 48% Profit-Loss Ratio 16.86 Alpha 0.018 Beta 1.716 Annual Standard Deviation 0.326 Annual Variance 0.107 Information Ratio 0.662 Tracking Error 0.157 Treynor Ratio 0.13 |
using System; using System.Collections; using System.Collections.Generic; using QuantConnect.Securities; using QuantConnect.Models; namespace QuantConnect { /*************************************************************************** HELPER FUNCTIONS Debug - Logging: Display log messages Quit - End Node Analysis: Call Quit() to end the server analysis Liquidate - Close all: sells all holdings in your portfolio at market rates. If a string symbol is provided it will liquidate your holdings in that security only. THIS IS AN EXAMPLE ALGORITHM FROM THE QUANTCONNECT'S API DOCUMENTATION ***************************************************************************/ public class SecurityManagerExample : QCAlgorithm { public override void Initialize() { AddSecurity(SecurityType.Equity, "SPY", Resolution.Minute); SetCash(50000); SetStartDate(2010,1, 1); SetEndDate(2013, 1, 1); } public void OnData(TradeBars securityData) { if (!Portfolio.HoldStock && Portfolio.Cash == 50000) { SetHoldings("SPY", 0.99); } //Sell all if SPY's price is too low if (Portfolio.HoldStock && securityData["SPY"].High > 135) { Liquidate(); //Liquidate("SPY"); } if (!Portfolio.HoldStock && securityData["SPY"].Low < 135) { SetHoldings("SPY", 1); } //Debug example if (securityData["SPY"].High < securityData["SPY"].Low){ Debug("Data is wrong!" + Time.ToShortTimeString()); } //Quit Example: /*if (rsi < 10) { Quit("Insufficient RSI Strength for Trading"); }*/ } } }