Overall Statistics
Total Trades
268
Average Win
0.20%
Average Loss
-0.03%
Compounding Annual Return
-61.892%
Drawdown
2.400%
Expectancy
-0.340
Net Profit
-1.052%
Sharpe Ratio
-5.779
Loss Rate
90%
Win Rate
10%
Profit-Loss Ratio
5.89
Alpha
0
Beta
-47.909
Annual Standard Deviation
0.092
Annual Variance
0.008
Information Ratio
-5.895
Tracking Error
0.092
Treynor Ratio
0.011
Total Fees
$894.78
namespace QuantConnect.Algorithm.CSharp
{
   
public class WarmupAlgorithm : QCAlgorithm
    {
        private bool _first = true;
        private string _symbol = "SPY";
        private const int FastPeriod = 60;
        private const int SlowPeriod = 3600;
        private ExponentialMovingAverage _fast, _slow;

        public override void Initialize()
        {
            SetStartDate(2013, 10, 08);  //Set Start Date
            SetEndDate(2013, 10, 11);    //Set End Date
            SetCash(100000);             //Set Strategy Cash
            // Find more symbols here: http://quantconnect.com/data
            AddSecurity(SecurityType.Equity, _symbol, Resolution.Second);

            _fast = EMA(_symbol, FastPeriod);
            _slow = EMA(_symbol, SlowPeriod);

            SetWarmup(SlowPeriod);
        }
        
        public override void OnData(Slice data)
        {
            if (_first && !IsWarmingUp)
            {
                _first = false;
                Debug("Fast: " + _fast.Samples);
                Debug("Slow: " + _slow.Samples);
            }
            if (_fast > _slow)
            {
                SetHoldings(_symbol, 1);
            }
            else
            {
                SetHoldings(_symbol, -1);
            }
        }
    }
}