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
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0
Beta
0
Annual Standard Deviation
0
Annual Variance
0
Information Ratio
0
Tracking Error
0
Treynor Ratio
0
Total Fees
$0.00
namespace QuantConnect.Algorithm.CSharp
{
    public class QuantumUncoupledInterceptor : QCAlgorithm
    {

        public override void Initialize()
        {
            SetStartDate(2019, 2, 20);  //Set Start Date
            SetCash(100000);             //Set Strategy Cash
            
            var symbol = AddEquity("SPY", Resolution.Minute).Symbol;
            RegisterIndicator(symbol, new AwesomeOscillator("TestDebugging"));
        }

        /// 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");
            //}
        }
    }
}
namespace QuantConnect {
    	public class AwesomeOscillator  : BarIndicator, IIndicatorWarmUpPeriodProvider{
    		private readonly int _period;
    		
    		public int WarmUpPeriod { get; }
    		public override bool IsReady => _slow_sma_queue.Count() == _period_slow;
    		
    		public int _period_fast;
    		public int _period_slow;
    		private List<decimal> _fast_sma_queue = new List<decimal>();
    		private List<decimal> _slow_sma_queue = new List<decimal>();
    		
    		public AwesomeOscillator(string name, int period_fast = 5, int period_slow = 34) : base(name){
    			_period_fast = period_fast;
    			_period_slow = period_slow;
    			
    		}
    		protected override decimal ComputeNextValue(IBaseDataBar input){
    			// Calculation AO = sma((high+low)/2, lengthAO1) - sma((high+low)/2, lengthAO2)

    			decimal CurrentQueue = ((input.Low + input.High)/ 2);
    			decimal fast_sma = 0m;
    			decimal slow_sma = 0m;
    			if(_period_fast >= _fast_sma_queue.Count()){
    				_fast_sma_queue.Add(CurrentQueue);
    			} else {
    				fast_sma = _fast_sma_queue.Sum() / _period_fast;
    			}
    				
    			if(_period_slow >= _slow_sma_queue.Count()){
    				_slow_sma_queue.Add(CurrentQueue);
    			} else {
    				slow_sma = _slow_sma_queue.Sum() / _period_slow;
    			}
    			return (fast_sma - slow_sma);
    		}
    	}
    }