hola por favor podrias revisar este codigo a ver si encuentras algun bug o si detectas alguna refacotirzacion o mejora notable que se pueda realizar.     public class IntermarketOscillatorStudy : BaseStudy
    {
        public delegate void PriceNormalizer(List<double> prices, int period);

        public DateOHLCSeries PriceData { get; private set; } = null;
        private IDiscontinuousDateTimeCalendar Calendar { get; set; } = null;

        private LineRenderableSeriesViewModel OscillatorRenderableSeries1 { get; } = new LineRenderableSeriesViewModel() { StrokeThickness = 1 };
        private LineRenderableSeriesViewModel OscillatorRenderableSeries2 { get; } = new LineRenderableSeriesViewModel() { StrokeThickness = 1 };
        private LineRenderableSeriesViewModel OscillatorRenderableSeries3 { get; } = new LineRenderableSeriesViewModel() { StrokeThickness = 1 };
 
        public IntermarketOscillatorStudy(AnalysisViewModel analysis) : base(analysis, "IntermarketOscillator", true)
        {
            OscillatorRenderableSeries1.DataSeries = OscillatorSeries1;
            OscillatorRenderableSeries2.DataSeries = OscillatorSeries2;
            OscillatorRenderableSeries3.DataSeries = OscillatorSeries3;

            IsVisibleInPricePane = false;

            Panes[0].SeriesViewModels.Add(OscillatorRenderableSeries1);
            Panes[0].SeriesViewModels.Add(OscillatorRenderableSeries2);
            Panes[0].SeriesViewModels.Add(OscillatorRenderableSeries3);
            Panes[0].YAxisTextFormatting = "0.0000";
        }

        public Instrument InstrumentA { get; } = new Instrument();
        public Instrument InstrumentB1 { get; } = new Instrument();
        public Instrument InstrumentB2 { get; } = new Instrument();
        public Instrument InstrumentB3 { get; } = new Instrument();

        private string _fastLineInputType = "Close";
        public string FastLineInputType
        {
            get => _fastLineInputType;
            set
            {
                _fastLineInputType = value;
                OnPropertyChanged(nameof(FastLineInputType));
            }
        }

        private string _slowLineInputType = "Close";
        public string SlowLineInputType
        {
            get => _slowLineInputType;
            set
            {
                _slowLineInputType = value;
                OnPropertyChanged(nameof(SlowLineInputType));
            }
        }

        private string _oscillatorInputType = "A-B";
        public string OscillatorInputType
        {
            get => _oscillatorInputType;
            set
            {
                _oscillatorInputType = value;
                OnPropertyChanged(nameof(OscillatorInputType));
            }
        }

        private string _oscillatorOutputType = "SMA";
        public string OscillatorOutputType
        {
            get => _oscillatorOutputType;
            set
            {
                _oscillatorOutputType = value;
                OnPropertyChanged(nameof(OscillatorOutputType));
            }
        }

        private string _fastLineMovingAverageType = "SMA";
        public string FastLineMovingAverageType
        {
            get => _fastLineMovingAverageType;
            set
            {
                _fastLineMovingAverageType = value;
                OnPropertyChanged(nameof(FastLineMovingAverageType));
            }
        }

        private string _slowLineMovingAverageType = "SMA";
        public string SlowLineMovingAverageType
        {
            get => _slowLineMovingAverageType;
            set
            {
                _slowLineMovingAverageType = value;
                OnPropertyChanged(nameof(SlowLineMovingAverageType));
            }
        }

        private string _fastLinePercentChangeType = "FromStart";
        public string FastLinePercentChangeType
        {
            get => _fastLinePercentChangeType;
            set
            {
                _fastLinePercentChangeType = value;
                OnPropertyChanged(nameof(FastLinePercentChangeType));
            }
        }

        private string _slowLinePercentChangeType = "FromStart";
        public string SlowLinePercentChangeType
        {
            get => _slowLinePercentChangeType;
            set
            {
                _slowLinePercentChangeType = value;
                OnPropertyChanged(nameof(SlowLinePercentChangeType));
            }
        }

        private string _signalLineMovingAverageType = "SMA";
        public string SignalLineMovingAverageType
        {
            get => _signalLineMovingAverageType;
            set
            {
                _signalLineMovingAverageType = value;
                OnPropertyChanged(nameof(SignalLineMovingAverageType));
            }
        }

        private double _fastLineModePercent = 0.5;
        public double FastLineModePercent
        {
            get => _fastLineModePercent;
            set
            {
                _fastLineModePercent = value;
                OnPropertyChanged(nameof(FastLineModePercent));
            }
        }

        private double _slowLineModePercent = 0.5;
        public double SlowLineModePercent
        {
            get => _slowLineModePercent;
            set
            {
                _slowLineModePercent = value;
                OnPropertyChanged(nameof(SlowLineModePercent));
            }
        }

        private double _oscillatorLineModePercent = 0.5;
        public double OscillatorLineModePercent
        {
            get => _oscillatorLineModePercent;
            set
            {
                _oscillatorLineModePercent = value;
                OnPropertyChanged(nameof(OscillatorLineModePercent));
            }
        }

        private double _signalLineModePercent = 0.5;
        public double SignalLineModePercent
        {
            get => _signalLineModePercent;
            set
            {
                _signalLineModePercent = value;
                OnPropertyChanged(nameof(SignalLineModePercent));
            }
        }

        private bool _fastLineModeBinMedian = false;
        public bool FastLineModeBinMedian
        {
            get => _fastLineModeBinMedian;
            set
            {
                _fastLineModeBinMedian = value;
                OnPropertyChanged(nameof(FastLineModeBinMedian));
            }
        }

        private bool _slowLineModeBinMedian = false;
        public bool SlowLineModeBinMedian
        {
            get => _slowLineModeBinMedian;
            set
            {
                _slowLineModeBinMedian = value;
                OnPropertyChanged(nameof(SlowLineModeBinMedian));
            }
        }

        private bool _oscillatorLineModeBinMedian = false;
        public bool OscillatorLineModeBinMedian
        {
            get => _oscillatorLineModeBinMedian;
            set
            {
                _oscillatorLineModeBinMedian = value;
                OnPropertyChanged(nameof(OscillatorLineModeBinMedian));
            }
        }

        private bool _signalLineModeBinMedian = false;
        public bool SignalLineModeBinMedian
        {
            get => _signalLineModeBinMedian;
            set
            {
                _signalLineModeBinMedian = value;
                OnPropertyChanged(nameof(SignalLineModeBinMedian));
            }
        }

        private int _fastLinePeriods = 12;
        public int FastLinePeriods
        {
            get => _fastLinePeriods;
            set
            {
                _fastLinePeriods = value;
                OnPropertyChanged(nameof(FastLinePeriods));
            }
        }

        private int _slowLinePeriods = 26;
        public int SlowLinePeriods
        {
            get => _slowLinePeriods;
            set
            {
                _slowLinePeriods = value;
                OnPropertyChanged(nameof(SlowLinePeriods));
            }
        }

        private string _normalizationType = "None";
        public string NormalizationType
        {
            get => _normalizationType;
            set
            {
                _normalizationType = value;
                OnPropertyChanged(nameof(NormalizationType));
            }
        }

        private int _normalizationPeriod = 0;
        public int NormalizationPeriod
        {
            get => _normalizationPeriod;
            set
            {
                _normalizationPeriod = value;
                OnPropertyChanged(nameof(NormalizationPeriod));
            }
        }

        private string _histogramNormalizationType = "None";
        public string HistogramNormalizationType
        {
            get => _histogramNormalizationType;
            set
            {
                _histogramNormalizationType = value;
                OnPropertyChanged(nameof(HistogramNormalizationType));
            }
        }

        private int _histogramNormalizationPeriod = 0;
        public int HistogramNormalizationPeriod
        {
            get => _histogramNormalizationPeriod;
            set
            {
                _histogramNormalizationPeriod = value;
                OnPropertyChanged(nameof(HistogramNormalizationPeriod));
            }
        }

        private int _signalLinePeriods = 9;
        public int SignalLinePeriods
        {
            get => _signalLinePeriods;
            set
            {
                _signalLinePeriods = value;
                OnPropertyChanged(nameof(SignalLinePeriods));
            }
        }

        private int _oscillatorLinePeriods = 1;
        public int OscillatorLinePeriods
        {
            get => _oscillatorLinePeriods;
            set
            {
                _oscillatorLinePeriods = value;
                OnPropertyChanged(nameof(OscillatorLinePeriods));
            }
        }

        private bool _isOscillator1Visible = true;
        public bool IsOscillator1Visible
        {
            get => _isOscillator1Visible;
            set
            {
                _isOscillator1Visible = value;
                OscillatorRenderableSeries1.IsVisible = _isOscillator1Visible;
                OnPropertyChanged(nameof(IsOscillator1Visible));
            }
        }

        private bool _isOscillator2Visible = true;
        public bool IsOscillator2Visible
        {
            get => _isOscillator2Visible;
            set
            {
                _isOscillator2Visible = value;
                OscillatorRenderableSeries2.IsVisible = _isOscillator2Visible;
                OnPropertyChanged(nameof(IsOscillator2Visible));
            }
        }

        private bool _isOscillator3Visible = true;
        public bool IsOscillator3Visible
        {
            get => _isOscillator3Visible;
            set
            {
                _isOscillator3Visible = value;
                OscillatorRenderableSeries3.IsVisible = _isOscillator3Visible;
                OnPropertyChanged(nameof(IsOscillator3Visible));
            }
        }

        public IXyDataSeries<DateTime, double> OscillatorSeries1 { get; } = new XyDataSeries<DateTime, double>() { SeriesName = "Oscillator1" };
        public IXyDataSeries<DateTime, double> OscillatorSeries2 { get; } = new XyDataSeries<DateTime, double>() { SeriesName = "Oscillator2" };
        public IXyDataSeries<DateTime, double> OscillatorSeries3 { get; } = new XyDataSeries<DateTime, double>() { SeriesName = "Oscillator3" };

        public override void Update(object param)
        {
            UpdateOscillators();
            OscillatorSeries1.InvalidateParentSurface(RangeMode.ZoomToFitY);
            OscillatorSeries2.InvalidateParentSurface(RangeMode.ZoomToFitY);
            OscillatorSeries3.InvalidateParentSurface(RangeMode.ZoomToFitY);
        }

        public override void OnDataUpdated(DateOHLCSeries priceData, RangeMode zoomRange, IDiscontinuousDateTimeCalendar calendar)
        {
            PriceData = priceData;
            Calendar = calendar;

            UpdateOscillators();
            OscillatorSeries1.InvalidateParentSurface(zoomRange);
            OscillatorSeries2.InvalidateParentSurface(zoomRange);
            OscillatorSeries3.InvalidateParentSurface(zoomRange);
        }

        public override void OnRemove()
        {
        }

        static public ICommand ConfigInstrumentCommand { get; } = new DelegateCommand(OnConfigInstrument);
        static private void OnConfigInstrument(object param)
        {
            if (param is Instrument instrument)
            {
                var dlg = new InstrumentDialogWindow(new InstrumentDialogViewModel(instrument));
                dlg.ShowDialog();
            }
        }

        public void UpdateOscillators()
        {
            using (OscillatorSeries1.SuspendUpdates())
            using (OscillatorSeries2.SuspendUpdates())
            using (OscillatorSeries2.SuspendUpdates())
            {
                OscillatorSeries1.Clear();
                OscillatorSeries2.Clear();
                OscillatorSeries3.Clear();

                var dataA  = InstrumentA.IsLoaded  ? InstrumentA.DateOHLCSeries  : PriceData;
                var dataB1 = InstrumentB1.IsLoaded ? InstrumentB1.DateOHLCSeries : PriceData;

                var dataList = new List<DateOHLCSeries>() { dataA, dataB1 };

                var dataB2 = InstrumentB2.IsLoaded ? InstrumentB2.DateOHLCSeries : null;
                if (dataB2 != null) dataList.Add(dataB2);

                var dataB3 = InstrumentB3.IsLoaded ? InstrumentB3.DateOHLCSeries : null;
                if (dataB3 != null) dataList.Add(dataB2);

                dataList.ResampleSeries(out List<List<DateOHLC>> resampledSeries, TimeSpan.FromDays(1.0));

                var priceDataA  = resampledSeries[0];
                var priceDataB1 = resampledSeries[1];
                var priceDataB2 = resampledSeries.Count > 2 ? resampledSeries[2] : null;
                var priceDataB3 = resampledSeries.Count > 3 ? resampledSeries[3] : null;

                if ((priceDataA?.Count > 0) && (priceDataB1?.Count > 0))
                {
                    int fastLinePercentChangeOrigin = FastLinePercentChangeType == "FromStart" ? 0 : FastLinePercentChangeType == "FromMean" ? 1 : 2;
                    int slowLinePercentChangeOrigin = SlowLinePercentChangeType == "FromStart" ? 0 : SlowLinePercentChangeType == "FromMean" ? 1 : 2;

                    var fastLinePrices = (FastLineInputType == "Midpoint") ? priceDataA.MidpointData().ToList() : priceDataA.CloseData().ToList();
                    var fastMASeries = (FastLineMovingAverageType == "Momentum") ? fastLinePrices.Momentum(FastLinePeriods, fastLinePercentChangeOrigin) : (FastLineMovingAverageType == "RateOfChange") ? fastLinePrices.RateOfChange(FastLinePeriods, fastLinePercentChangeOrigin) : (FastLineMovingAverageType == "PercentChange") ? fastLinePrices.PercentChange(FastLinePeriods, fastLinePercentChangeOrigin) : (FastLineMovingAverageType == "SMA") ? fastLinePrices.SMA(FastLinePeriods) : (FastLineMovingAverageType == "EMA") ? fastLinePrices.EMA(FastLinePeriods) : (FastLineMovingAverageType == "CMA") ? fastLinePrices.CMA(FastLinePeriods) : (FastLineMovingAverageType == "Median") ? fastLinePrices.MovingMedian(FastLinePeriods) : fastLinePrices.MovingMode(FastLinePeriods, FastLineModePercent / 100.0, FastLineModeBinMedian);

                    var slowLinePrices = (SlowLineInputType == "Midpoint") ? priceDataB1.MidpointData().ToList() : priceDataB1.CloseData().ToList();
                    var slowMASeries = (SlowLineMovingAverageType == "Momentum") ? slowLinePrices.Momentum(SlowLinePeriods, slowLinePercentChangeOrigin) : (SlowLineMovingAverageType == "RateOfChange") ? slowLinePrices.RateOfChange(SlowLinePeriods, slowLinePercentChangeOrigin) : (SlowLineMovingAverageType == "PercentChange") ? slowLinePrices.PercentChange(SlowLinePeriods, slowLinePercentChangeOrigin) : (SlowLineMovingAverageType == "SMA") ? slowLinePrices.SMA(SlowLinePeriods) : (SlowLineMovingAverageType == "EMA") ? slowLinePrices.EMA(SlowLinePeriods) : (SlowLineMovingAverageType == "CMA") ? slowLinePrices.CMA(SlowLinePeriods) : (SlowLineMovingAverageType == "Median") ? slowLinePrices.MovingMedian(SlowLinePeriods) : slowLinePrices.MovingMode(SlowLinePeriods, SlowLineModePercent / 100.0, SlowLineModeBinMedian);

                    List<double> oscillator = ((OscillatorInputType == "A") ? fastMASeries : (OscillatorInputType == "B") ? slowMASeries : (OscillatorInputType == "A-B") ? fastMASeries.Subtract(slowMASeries) : (OscillatorInputType == "B-A") ? slowMASeries.Subtract(fastMASeries) : (OscillatorInputType == "A+B") ? fastMASeries.Add(slowMASeries) : (OscillatorInputType == "A*B") ? fastMASeries.Multiply(slowMASeries) : (OscillatorInputType == "A/B") ? fastMASeries.Divide(slowMASeries) : slowMASeries.Divide(fastMASeries)).ToList();

                    if (NormalizationPeriod > 3)
                    {
                        PriceNormalizationTypes[NormalizationType](oscillator, NormalizationPeriod);
                    }

                    var oscillatorMASeries = (OscillatorOutputType == "SMA") ? oscillator.SMA(OscillatorLinePeriods) : (OscillatorOutputType == "EMA") ? oscillator.EMA(OscillatorLinePeriods) : (OscillatorOutputType == "CMA") ? oscillator.ToList().CMA(OscillatorLinePeriods) : (OscillatorOutputType == "Median") ? oscillator.MovingMedian(OscillatorLinePeriods) : oscillator.MovingMode(OscillatorLinePeriods, OscillatorLineModePercent / 100.0, OscillatorLineModeBinMedian);

                    if (SignalLinePeriods > 1)
                    {
                        var signalLineMASeries = (SignalLineMovingAverageType == "SMA") ? oscillatorMASeries.SMA(SignalLinePeriods) : (SignalLineMovingAverageType == "EMA") ? oscillatorMASeries.EMA(SignalLinePeriods) : (SignalLineMovingAverageType == "CMA") ? oscillatorMASeries.ToList().CMA(SignalLinePeriods) : (SignalLineMovingAverageType == "Median") ? oscillatorMASeries.MovingMedian(SignalLinePeriods) : oscillatorMASeries.MovingMode(SignalLinePeriods, SignalLineModePercent / 100.0, SignalLineModeBinMedian);

                        var divergenceLine = oscillatorMASeries.Subtract(signalLineMASeries);

                        if (HistogramNormalizationPeriod > 3)
                        {
                            var divergenceLineList = divergenceLine.ToList();
                            PriceNormalizationTypes[HistogramNormalizationType](divergenceLineList, HistogramNormalizationPeriod);
                            divergenceLine = divergenceLineList;
                        }

                        OscillatorSeries1.Append(priceDataA.TimeData(), divergenceLine);
                    }
                    else
                    {
                        if (HistogramNormalizationPeriod > 3)
                        {
                            var oscillatorMASeriesList = oscillatorMASeries.ToList();
                            PriceNormalizationTypes[HistogramNormalizationType](oscillatorMASeriesList, HistogramNormalizationPeriod);
                            oscillatorMASeries = oscillatorMASeriesList;
                        }

                        OscillatorSeries1.Append(priceDataA.TimeData(), oscillatorMASeries);
                    }
                }

                if ((priceDataA?.Count > 0) && (priceDataB2?.Count > 0))
                {
                    int fastLinePercentChangeOrigin = FastLinePercentChangeType == "FromStart" ? 0 : FastLinePercentChangeType == "FromMean" ? 1 : 2;
                    int slowLinePercentChangeOrigin = SlowLinePercentChangeType == "FromStart" ? 0 : SlowLinePercentChangeType == "FromMean" ? 1 : 2;

                    var fastLinePrices = (FastLineInputType == "Midpoint") ? priceDataA.MidpointData().ToList() : priceDataA.CloseData().ToList();
                    var fastMASeries = (FastLineMovingAverageType == "Momentum") ? fastLinePrices.Momentum(FastLinePeriods, fastLinePercentChangeOrigin) : (FastLineMovingAverageType == "RateOfChange") ? fastLinePrices.RateOfChange(FastLinePeriods, fastLinePercentChangeOrigin) : (FastLineMovingAverageType == "PercentChange") ? fastLinePrices.PercentChange(FastLinePeriods, fastLinePercentChangeOrigin) : (FastLineMovingAverageType == "SMA") ? fastLinePrices.SMA(FastLinePeriods) : (FastLineMovingAverageType == "EMA") ? fastLinePrices.EMA(FastLinePeriods) : (FastLineMovingAverageType == "CMA") ? fastLinePrices.CMA(FastLinePeriods) : (FastLineMovingAverageType == "Median") ? fastLinePrices.MovingMedian(FastLinePeriods) : fastLinePrices.MovingMode(FastLinePeriods, FastLineModePercent / 100.0, FastLineModeBinMedian);

                    var slowLinePrices = (SlowLineInputType == "Midpoint") ? priceDataB2.MidpointData().ToList() : priceDataB2.CloseData().ToList();
                    var slowMASeries = (SlowLineMovingAverageType == "Momentum") ? slowLinePrices.Momentum(SlowLinePeriods, slowLinePercentChangeOrigin) : (SlowLineMovingAverageType == "RateOfChange") ? slowLinePrices.RateOfChange(SlowLinePeriods, slowLinePercentChangeOrigin) : (SlowLineMovingAverageType == "PercentChange") ? slowLinePrices.PercentChange(SlowLinePeriods, slowLinePercentChangeOrigin) : (SlowLineMovingAverageType == "SMA") ? slowLinePrices.SMA(SlowLinePeriods) : (SlowLineMovingAverageType == "EMA") ? slowLinePrices.EMA(SlowLinePeriods) : (SlowLineMovingAverageType == "CMA") ? slowLinePrices.CMA(SlowLinePeriods) : (SlowLineMovingAverageType == "Median") ? slowLinePrices.MovingMedian(SlowLinePeriods) : slowLinePrices.MovingMode(SlowLinePeriods, SlowLineModePercent / 100.0, SlowLineModeBinMedian);

                    List<double> oscillator = ((OscillatorInputType == "A") ? fastMASeries : (OscillatorInputType == "B") ? slowMASeries : (OscillatorInputType == "A-B") ? fastMASeries.Subtract(slowMASeries) : (OscillatorInputType == "B-A") ? slowMASeries.Subtract(fastMASeries) : (OscillatorInputType == "A+B") ? fastMASeries.Add(slowMASeries) : (OscillatorInputType == "A*B") ? fastMASeries.Multiply(slowMASeries) : (OscillatorInputType == "A/B") ? fastMASeries.Divide(slowMASeries) : slowMASeries.Divide(fastMASeries)).ToList();

                    if (NormalizationPeriod > 3)
                    {
                        PriceNormalizationTypes[NormalizationType](oscillator, NormalizationPeriod);
                    }

                    var oscillatorMASeries = (OscillatorOutputType == "SMA") ? oscillator.SMA(OscillatorLinePeriods) : (OscillatorOutputType == "EMA") ? oscillator.EMA(OscillatorLinePeriods) : (OscillatorOutputType == "CMA") ? oscillator.ToList().CMA(OscillatorLinePeriods) : (OscillatorOutputType == "Median") ? oscillator.MovingMedian(OscillatorLinePeriods) : oscillator.MovingMode(OscillatorLinePeriods, OscillatorLineModePercent / 100.0, OscillatorLineModeBinMedian);

                    if (SignalLinePeriods > 1)
                    {
                        var signalLineMASeries = (SignalLineMovingAverageType == "SMA") ? oscillatorMASeries.SMA(SignalLinePeriods) : (SignalLineMovingAverageType == "EMA") ? oscillatorMASeries.EMA(SignalLinePeriods) : (SignalLineMovingAverageType == "CMA") ? oscillatorMASeries.ToList().CMA(SignalLinePeriods) : (SignalLineMovingAverageType == "Median") ? oscillatorMASeries.MovingMedian(SignalLinePeriods) : oscillatorMASeries.MovingMode(SignalLinePeriods, SignalLineModePercent / 100.0, SignalLineModeBinMedian);

                        var divergenceLine = oscillatorMASeries.Subtract(signalLineMASeries);

                        if (HistogramNormalizationPeriod > 3)
                        {
                            var divergenceLineList = divergenceLine.ToList();
                            PriceNormalizationTypes[HistogramNormalizationType](divergenceLineList, HistogramNormalizationPeriod);
                            divergenceLine = divergenceLineList;
                        }

                        OscillatorSeries2.Append(priceDataA.TimeData(), divergenceLine);
                    }
                    else
                    {
                        if (HistogramNormalizationPeriod > 3)
                        {
                            var oscillatorMASeriesList = oscillatorMASeries.ToList();
                            PriceNormalizationTypes[HistogramNormalizationType](oscillatorMASeriesList, HistogramNormalizationPeriod);
                            oscillatorMASeries = oscillatorMASeriesList;
                        }

                        OscillatorSeries2.Append(priceDataA.TimeData(), oscillatorMASeries);
                    }
                }

                if ((priceDataA?.Count > 0) && (priceDataB3?.Count > 0))
                {
                    int fastLinePercentChangeOrigin = FastLinePercentChangeType == "FromStart" ? 0 : FastLinePercentChangeType == "FromMean" ? 1 : 2;
                    int slowLinePercentChangeOrigin = SlowLinePercentChangeType == "FromStart" ? 0 : SlowLinePercentChangeType == "FromMean" ? 1 : 2;

                    var fastLinePrices = (FastLineInputType == "Midpoint") ? priceDataA.MidpointData().ToList() : priceDataA.CloseData().ToList();
                    var fastMASeries = (FastLineMovingAverageType == "Momentum") ? fastLinePrices.Momentum(FastLinePeriods, fastLinePercentChangeOrigin) : (FastLineMovingAverageType == "RateOfChange") ? fastLinePrices.RateOfChange(FastLinePeriods, fastLinePercentChangeOrigin) : (FastLineMovingAverageType == "PercentChange") ? fastLinePrices.PercentChange(FastLinePeriods, fastLinePercentChangeOrigin) : (FastLineMovingAverageType == "SMA") ? fastLinePrices.SMA(FastLinePeriods) : (FastLineMovingAverageType == "EMA") ? fastLinePrices.EMA(FastLinePeriods) : (FastLineMovingAverageType == "CMA") ? fastLinePrices.CMA(FastLinePeriods) : (FastLineMovingAverageType == "Median") ? fastLinePrices.MovingMedian(FastLinePeriods) : fastLinePrices.MovingMode(FastLinePeriods, FastLineModePercent / 100.0, FastLineModeBinMedian);

                    var slowLinePrices = (SlowLineInputType == "Midpoint") ? priceDataB3.MidpointData().ToList() : priceDataB3.CloseData().ToList();
                    var slowMASeries = (SlowLineMovingAverageType == "Momentum") ? slowLinePrices.Momentum(SlowLinePeriods, slowLinePercentChangeOrigin) : (SlowLineMovingAverageType == "RateOfChange") ? slowLinePrices.RateOfChange(SlowLinePeriods, slowLinePercentChangeOrigin) : (SlowLineMovingAverageType == "PercentChange") ? slowLinePrices.PercentChange(SlowLinePeriods, slowLinePercentChangeOrigin) : (SlowLineMovingAverageType == "SMA") ? slowLinePrices.SMA(SlowLinePeriods) : (SlowLineMovingAverageType == "EMA") ? slowLinePrices.EMA(SlowLinePeriods) : (SlowLineMovingAverageType == "CMA") ? slowLinePrices.CMA(SlowLinePeriods) : (SlowLineMovingAverageType == "Median") ? slowLinePrices.MovingMedian(SlowLinePeriods) : slowLinePrices.MovingMode(SlowLinePeriods, SlowLineModePercent / 100.0, SlowLineModeBinMedian);

                    List<double> oscillator = ((OscillatorInputType == "A") ? fastMASeries : (OscillatorInputType == "B") ? slowMASeries : (OscillatorInputType == "A-B") ? fastMASeries.Subtract(slowMASeries) : (OscillatorInputType == "B-A") ? slowMASeries.Subtract(fastMASeries) : (OscillatorInputType == "A+B") ? fastMASeries.Add(slowMASeries) : (OscillatorInputType == "A*B") ? fastMASeries.Multiply(slowMASeries) : (OscillatorInputType == "A/B") ? fastMASeries.Divide(slowMASeries) : slowMASeries.Divide(fastMASeries)).ToList();

                    if (NormalizationPeriod > 3)
                    {
                        PriceNormalizationTypes[NormalizationType](oscillator, NormalizationPeriod);
                    }

                    var oscillatorMASeries = (OscillatorOutputType == "SMA") ? oscillator.SMA(OscillatorLinePeriods) : (OscillatorOutputType == "EMA") ? oscillator.EMA(OscillatorLinePeriods) : (OscillatorOutputType == "CMA") ? oscillator.ToList().CMA(OscillatorLinePeriods) : (OscillatorOutputType == "Median") ? oscillator.MovingMedian(OscillatorLinePeriods) : oscillator.MovingMode(OscillatorLinePeriods, OscillatorLineModePercent / 100.0, OscillatorLineModeBinMedian);

                    if (SignalLinePeriods > 1)
                    {
                        var signalLineMASeries = (SignalLineMovingAverageType == "SMA") ? oscillatorMASeries.SMA(SignalLinePeriods) : (SignalLineMovingAverageType == "EMA") ? oscillatorMASeries.EMA(SignalLinePeriods) : (SignalLineMovingAverageType == "CMA") ? oscillatorMASeries.ToList().CMA(SignalLinePeriods) : (SignalLineMovingAverageType == "Median") ? oscillatorMASeries.MovingMedian(SignalLinePeriods) : oscillatorMASeries.MovingMode(SignalLinePeriods, SignalLineModePercent / 100.0, SignalLineModeBinMedian);

                        var divergenceLine = oscillatorMASeries.Subtract(signalLineMASeries);

                        if (HistogramNormalizationPeriod > 3)
                        {
                            var divergenceLineList = divergenceLine.ToList();
                            PriceNormalizationTypes[HistogramNormalizationType](divergenceLineList, HistogramNormalizationPeriod);
                            divergenceLine = divergenceLineList;
                        }

                        OscillatorSeries3.Append(priceDataA.TimeData(), divergenceLine);
                    }
                    else
                    {
                        if (HistogramNormalizationPeriod > 3)
                        {
                            var oscillatorMASeriesList = oscillatorMASeries.ToList();
                            PriceNormalizationTypes[HistogramNormalizationType](oscillatorMASeriesList, HistogramNormalizationPeriod);
                            oscillatorMASeries = oscillatorMASeriesList;
                        }

                        OscillatorSeries3.Append(priceDataA.TimeData(), oscillatorMASeries);
                    }
                }
            }

            if (Calendar != null)
            {
                OscillatorRenderableSeries1.DataSeries = OscillatorSeries1.ToDiscontinuousSeries(Calendar);
                OscillatorRenderableSeries2.DataSeries = OscillatorSeries2.ToDiscontinuousSeries(Calendar);
                OscillatorRenderableSeries3.DataSeries = OscillatorSeries3.ToDiscontinuousSeries(Calendar);
            }

            OscillatorSeries1.SeriesName = $"IntermarketOscillator1({FastLinePeriods},{SlowLinePeriods},{SignalLinePeriods})";
            OscillatorSeries2.SeriesName = $"IntermarketOscillator2({FastLinePeriods},{SlowLinePeriods},{SignalLinePeriods})";
            OscillatorSeries3.SeriesName = $"IntermarketOscillator3({FastLinePeriods},{SlowLinePeriods},{SignalLinePeriods})";
            Title = $"IntermarketOscillator({FastLinePeriods},{SlowLinePeriods},{SignalLinePeriods})";
        }