Overall Statistics
Total Trades
2506
Average Win
0.29%
Average Loss
-0.32%
Compounding Annual Return
-10.580%
Drawdown
43.600%
Expectancy
-0.138
Net Profit
-42.863%
Sharpe Ratio
-1.398
Probabilistic Sharpe Ratio
0.000%
Loss Rate
55%
Win Rate
45%
Profit-Loss Ratio
0.91
Alpha
-0.088
Beta
0.19
Annual Standard Deviation
0.061
Annual Variance
0.004
Information Ratio
-1.255
Tracking Error
0.08
Treynor Ratio
-0.448
Total Fees
$6128.00
Estimated Strategy Capacity
$12000000.00
Lowest Capacity Asset
EURUSD 5O
namespace QuantConnect
{
    public class BootCampTask : QCAlgorithm
    {
    	Minimum lowBeforeOpen;
    	Maximum highBeforeOpen;
        public override void Initialize()
        {
            SetStartDate(2016, 6, 1);
            SetEndDate(2021, 6, 1);
            SetCash(100000);
            
            AddEquity("SPY", Resolution.Minute);
            AddForex("EURUSD", Resolution.Minute, Market.FXCM);
            
            Schedule.On(DateRules.EveryDay("SPY"), TimeRules.AfterMarketOpen("SPY", 0), MarketOpen);
            Schedule.On(DateRules.EveryDay("SPY"), TimeRules.BeforeMarketClose("SPY", 5), ClosePosition);
            
            SetTimeZone(TimeZones.NewYork);
            SetBrokerageModel(BrokerageName.FxcmBrokerage);
        }

        public override void OnData(Slice data)
        {
        	if (lowBeforeOpen == null || highBeforeOpen == null) return;
        	
        	if (Time.Hour >= 10 || Time.Minute < 31) return;
        	
        	if (data.ContainsKey("EURUSD") && !Portfolio.Invested)
        	{
				decimal currentPrice = data["EURUSD"].Close;
				if (currentPrice > highBeforeOpen)	
				{
					SetHoldings("EURUSD", 1);
				}
				else if (currentPrice < lowBeforeOpen)
				{
					SetHoldings("EURUSD", -1);
				}
        	}
        }
        
        public void MarketOpen()
        {
        	lowBeforeOpen = new Minimum(15);
        	highBeforeOpen = new Maximum(15);
        	var history = History<QuoteBar>("EURUSD", 15, Resolution.Minute);
        	foreach (var quoteBar in history)
        	{
        		lowBeforeOpen.Update(quoteBar.Time, quoteBar.Low);
        		highBeforeOpen.Update(quoteBar.Time, quoteBar.High);
        	}
        }
        
        public void ClosePosition()
        {
        	Liquidate("EURUSD");
        }
    }
}