Overall Statistics |
Total Trades 18 Average Win 3.29% Average Loss -0.60% Compounding Annual Return 18.962% Drawdown 7.700% Expectancy 3.100 Net Profit 18.962% Sharpe Ratio 1.388 Loss Rate 36% Win Rate 64% Profit-Loss Ratio 5.44 Alpha 0.125 Beta -0.016 Annual Standard Deviation 0.089 Annual Variance 0.008 Information Ratio 0.349 Tracking Error 0.131 Treynor Ratio -7.606 Total Fees $0.00 |
using System; using System.Globalization; using QuantConnect.Data; using QuantConnect.Indicators.CandlestickPatterns; namespace QuantConnect.Algorithm.CSharp { /// <summary> /// Basic template algorithm simply initializes the date range and cash /// </summary> public class CandlestickClosingMarubozuAlgorithm : QCAlgorithm { private string _symbol = "YAHOO/INDEX_SPY"; private ClosingMarubozu _pattern = new ClosingMarubozu(); /// <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(2014, 01, 01); //Set Start Date SetEndDate(2014, 12, 31); //Set End Date SetCash(100000); //Set Strategy Cash AddData<CloseMar>(_symbol, Resolution.Daily); _pattern = CandlestickPatterns.ClosingMarubozu(_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 void OnData(CloseMar data) { if (_pattern == 1) { // Bullish ClosingMarubozu, go long Debug(Time + " -> found Bullish ClosingMarubozu"); SetHoldings(_symbol, 1); } else if (_pattern == -1) { // Bearish ClosingMarubozu, go short Debug(Time + " -> found Bearish ClosingMarubozu"); SetHoldings(_symbol, -1); } } } public class CloseMar : Quandl { public CloseMar() : base(valueColumnName: "Adjusted Close") { } } }