Overall Statistics
Total Trades
12
Average Win
1.60%
Average Loss
-3.01%
Compounding Annual Return
-9.772%
Drawdown
17.500%
Expectancy
-0.387
Net Profit
-9.772%
Sharpe Ratio
-0.551
Probabilistic Sharpe Ratio
4.042%
Loss Rate
60%
Win Rate
40%
Profit-Loss Ratio
0.53
Alpha
-0.074
Beta
0.027
Annual Standard Deviation
0.133
Annual Variance
0.018
Information Ratio
-0.492
Tracking Error
0.19
Treynor Ratio
-2.71
Total Fees
$38.89
Estimated Strategy Capacity
$730000000.00
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 Engulfing _pattern = new Engulfing();

        /// <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.Daily);

            _pattern = CandlestickPatterns.Engulfing(_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 Engulfing, go long
                SetHoldings(_symbol, 1);
            }
            else if (_pattern == -1)
            {
                // Bearish Engulfing, go short
                SetHoldings(_symbol, -1);
            }
        }
    }
}