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
-0.421
Tracking Error
0.162
Treynor Ratio
0
Total Fees
$0.00
Estimated Strategy Capacity
$0
Lowest Capacity Asset
using System;
using System.Collections.Concurrent;
using System.Linq;
using QuantConnect.Data.Market;
using QuantConnect.Data.UniverseSelection;
using QuantConnect.Indicators;

namespace QuantConnect.Algorithm.CSharp
{
    public class AlertBlackViper : QCAlgorithm
    {
    	private ConcurrentDictionary<Symbol, SelectionData> costats = new ConcurrentDictionary<Symbol, SelectionData>();
    	
    	
    	
    	private class SelectionData
        {
        	public RelativeStrengthIndex rsi;
        	public SimpleMovingAverage sRSI; 
        	public SimpleMovingAverage fast;
        	public SimpleMovingAverage slow;
        	public IchimokuKinkoHyo ichi;
        	public RollingWindow<decimal> roll;
        	public long marketCap;
			
            public SelectionData(QCAlgorithm algy, Symbol sym)
            {
                rsi = new RelativeStrengthIndex(14);
                sRSI = new SimpleMovingAverage(10).Of(rsi);
                fast = new SimpleMovingAverage(50);
                slow = new SimpleMovingAverage(200);
                ichi = new IchimokuKinkoHyo(9,26,52);
                roll = new RollingWindow<decimal>(27);
                IEnumerable<TradeBar> bars = algy.History<TradeBar>(sym, 200);
                foreach(TradeBar bar in bars)
                {
                	Update(bar);
                }
                marketCap = 0;
            }
            public bool Update(TradeBar tb)
            {
            	int success = 0;
            	DateTime time = tb.EndTime;
            	decimal value = tb.Close;
            	
            	if(rsi.Update(time, value))
            	{
            		
            		if(sRSI.Update(time, rsi))
            		{
            			success++;
            		}
            	}
        		roll.Add(value);
        		fast.Update(time, value);
            	slow.Update(time, value);
            	if(ichi.Update(tb))
            	{
            		
            		success++;
            	}
            	return success == 2;
            }
            
            public bool setMarketCap(long amt)
            {
            	if(amt <= 4000000000L)
            	{
            		marketCap = 0;
            		return false;
            	}
            	marketCap = amt;
            	return true;
            }
          
            public decimal ScaledDelta
            {
                get { return (fast - slow)/((fast + slow)/2m); }
            }
        }

        public override void Initialize()
        { 
            SetCash(1000);
            UniverseSettings.Resolution = Resolution.Daily;
        	SetStartDate(1998, 1, 1);
			SetEndDate(2021, 1, 1);
			AddSecurity(SecurityType.Equity, "SPY", Resolution.Daily);
			AddUniverse<TradeBar>("myCustomUniverse", Resolution.Daily, SelectCoarse);

        }

        /// 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 void OnData(TradeBars tbs)
        {
        	
        	if(IsWarmingUp)
        		return; 
        	List<Symbol> data = (from s in tbs select s.Key).ToList();
			
			
        }



        public IEnumerable<Symbol> SelectCoarse(IEnumerable<TradeBar> tbs)
        {
        	foreach(TradeBar tb in tbs)
        	{
        		Debug(tb.Symbol);
        	}
        	return (from tb in tbs
				select tb.Symbol);
        }
        public IEnumerable<Symbol> SelectFine(IEnumerable<FineFundamental> fine)
        {
            return (from f in fine
            	select f.Symbol);
        }
    }
}