Overall Statistics
Total Trades
3
Average Win
0%
Average Loss
-10.70%
Compounding Annual Return
-49.741%
Drawdown
32.900%
Expectancy
-1
Net Profit
-4.902%
Sharpe Ratio
-0.167
Probabilistic Sharpe Ratio
38.154%
Loss Rate
100%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
-0.47
Beta
2.662
Annual Standard Deviation
0.983
Annual Variance
0.967
Information Ratio
-0.327
Tracking Error
0.855
Treynor Ratio
-0.062
Total Fees
$3.00
namespace QuantConnect.Algorithm.CSharp
{
    public class QuantumTransdimensionalReplicator : QCAlgorithm
    {
		public Symbol symbol;

        public override void Initialize()
        {
            SetStartDate(2020, 8, 20);  //Set Start Date
            SetEndDate(2020, 9, 15);  //Set Start Date
            SetCash(10000);             //Set Strategy Cash
            //Brokerage model and account type:
            SetBrokerageModel(BrokerageName.InteractiveBrokersBrokerage, AccountType.Cash);
            
            this.symbol = QuantConnect.Symbol.Create("TQQQ", SecurityType.Equity, Market.USA); 
            AddSecurity(this.symbol, Resolution.Minute);
            
			this.Schedule.On(DateRules.EveryDay(this.symbol), TimeRules.BeforeMarketClose(this.symbol, 14), Buy);
        }

        /// OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
        /// Slice object keyed by symbol containing the stock data
        public override void OnData(Slice data)
        {
            // if (!Portfolio.Invested)
            // {
            //    SetHoldings("SPY", 1);
            //    Debug("Purchased Stock");
            //}
        }
        
         private void Buy()
        {
            if (!Portfolio.Invested)
            {
            	int qty = (int)Math.Floor(CalculateOrderQuantity(symbol, 0.98));
				MarketOrder(symbol, qty);
            }
        }

        public override void OnOrderEvent(OrderEvent orderEvent)
        {
            var order = Transactions.GetOrderById(orderEvent.OrderId);
            if (orderEvent.Status == OrderStatus.Filled)
            {
                StopMarketOrder(this.symbol, -orderEvent.Quantity, orderEvent.FillPrice * 0.9m);
            }
        }

    }
}