Overall Statistics
Total Trades
1
Average Win
0%
Average Loss
0%
Compounding Annual Return
21.210%
Drawdown
6.000%
Expectancy
0
Net Profit
0%
Sharpe Ratio
1.892
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0.072
Beta
0.867
Annual Standard Deviation
0.104
Annual Variance
0.011
Information Ratio
1.304
Tracking Error
0.04
Treynor Ratio
0.227
Total Fees
$1.00
using QuantConnect.Indicators.CandlestickPatterns;

namespace QuantConnect 
{   
    public class BasicTemplateAlgorithm : QCAlgorithm
    {
    	private InvertedHammer _invertedHammer;
    	
        public override void Initialize() 
        {
            SetCash(25000);
            SetStartDate(2016, 1, 1);         
            
            AddEquity("SPY", Resolution.Hour);
            
            _invertedHammer = CandlestickPatterns.InvertedHammer("SPY", Resolution.Hour);
        }

        public override void OnData(Slice data) 
        {
            if(_invertedHammer > 0) Log("Inverted Hammer at: " + Time);

        	//The returned value is positive(+1): inverted hammer is always bullish;
        	if (!Portfolio.HoldStock && _invertedHammer > 0) {
                SetHoldings("SPY", 1);
                Log("Bought SPY at " + Time + " for $" + data["SPY"].Close);
            }
        }
    }
}