Overall Statistics
Total Trades
0
Average Win
0%
Average Loss
0%
Compounding Annual Return
0%
Drawdown
0%
Expectancy
0
Net Profit
0%
Sharpe Ratio
0
Probabilistic Sharpe Ratio
0%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0
Beta
0
Annual Standard Deviation
0
Annual Variance
0
Information Ratio
-9.502
Tracking Error
0.096
Treynor Ratio
0
Total Fees
$0.00
Estimated Strategy Capacity
$0
using System;
using QuantConnect.Data.Market;
using QuantConnect.Data;
using QuantConnect.Securities;
using System.Collections.Generic;

namespace QuantConnect.Algorithm.CSharp
{
   public class ExampleRS : QCAlgorithm
   {
      // Contains all of our equity symbols
      public readonly IReadOnlyList<string> EquitySymbols = new List<string>
        {
         "NIO"
      };

      public readonly IReadOnlyList<string> FSIPSymbols = new List<string>
     {
         "AMD","CCL","AAL","PLTR"
      };

      private readonly DateTime startDate = new DateTime(2021, 4, 12, 0, 0, 0);
      private readonly DateTime endDate = new DateTime(2021, 4, 15, 0, 0, 0);

      private readonly decimal startingCash = 100000;

      public override void Initialize()
      {
         SetStartDate(startDate.Date);  // Set Start Date
         SetEndDate(endDate.Date);      // Set End Date
         SetCash(startingCash);         // Set Strategy Cash

         foreach (var symbol in EquitySymbols)
         {
            const bool fillDataForward = true; // returns the last available data even if none in that timeslice
            const bool extendedMarketHours = true; // Show pre/post market data

            var equity = AddEquity(symbol, Resolution.Minute, Market.USA, fillDataForward,
                                    Security.NullLeverage, extendedMarketHours);


         }

         Schedule.On(DateRules.Every(DayOfWeek.Tuesday), TimeRules.AfterMarketOpen(EquitySymbols[0], -20), FindStocksToTrade);
      }

      public void FindStocksToTrade()
      {
         Log("--- FindStocksToTrade ENTRY ---");

         const bool fillDataForward = true; // returns the last available data even if none in that timeslice
         const bool extendedMarketHours = true; // Show pre/post market data

         foreach (var fsip in FSIPSymbols)
         {
            var equity = AddEquity(fsip, Resolution.Minute, Market.USA, fillDataForward, Security.NullLeverage, extendedMarketHours);
            Log($"     Add {equity.Symbol}");
            var histBars = History<TradeBar>(equity.Symbol, 60, Resolution.Minute);
            foreach (var histBar in histBars)
            {
               // Do stuff
            }
            Log($"     Remove {equity.Symbol}");
            RemoveSecurity(equity.Symbol);
         }
         Log("--- FindStocksToTrade EXIT ---");
      }

      public override void OnData(Slice data)
      {
         if (Time.Hour == 9 && Time.Minute == 45)
         {
            foreach (var kvp in Securities)
            {
               Log($"OnData: symbol = {kvp.Key}, hasData = {kvp.Value.HasData}");
            }
            if (data.HasData)
            {
               foreach (var kvp in data)
               {
                  Log($"OnData: symbol = {kvp.Key}, Price = {kvp.Value.Price}, EndTime = {kvp.Value.EndTime}");
               }
            }
         }
      }
   }
}