Overall Statistics |
Total Trades 50 Average Win 0.96% Average Loss -0.56% Compounding Annual Return -5.191% Drawdown 16.200% Expectancy -0.220 Net Profit -5.186% Sharpe Ratio -0.266 Loss Rate 71% Win Rate 29% Profit-Loss Ratio 1.73 Alpha -0.038 Beta -0.11 Annual Standard Deviation 0.154 Annual Variance 0.024 Information Ratio -0.287 Tracking Error 0.23 Treynor Ratio 0.373 Total Fees $147.83 |
using QuantConnect.Indicators.CandlestickPatterns; namespace QuantConnect { /// <summary> /// Basic template algorithm simply initializes the date range and cash /// </summary> public class TestCandlestickAlgorithm : QCAlgorithm { private string _symbol = "SPY"; private Harami _pattern = new Harami(); /// <summary> /// Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized. /// </summary> public override void Initialize() { SetStartDate(2015, 1, 1); //Set Start Date SetEndDate(2015, 12, 31); //Set End Date SetCash(100000); //Set Strategy Cash // Find more symbols here: http://quantconnect.com/data AddEquity(_symbol, Resolution.Hour); _pattern = CandlestickPatterns.Harami(_symbol); } /// <summary> /// OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here. /// </summary> /// <param name="data">Slice object keyed by symbol containing the stock data</param> public override void OnData(Slice data) { if (_pattern == 1) { // Bullish Harami, go long SetHoldings(_symbol, 1); } else if (_pattern == -1) { // Bearish Harami, go short SetHoldings(_symbol, -1); } } } }