Exemple #1
0
        /// <summary>
        /// Enter the description of your new custom indicator here
        /// </summary>
        /// <returns></returns>
        public EncogExample EncogExample(Data.IDataSeries input, bool export)
        {
            if (cacheEncogExample != null)
            {
                for (int idx = 0; idx < cacheEncogExample.Length; idx++)
                {
                    if (cacheEncogExample[idx].Export == export && cacheEncogExample[idx].EqualsInput(input))
                    {
                        return(cacheEncogExample[idx]);
                    }
                }
            }

            lock (checkEncogExample)
            {
                checkEncogExample.Export = export;
                export = checkEncogExample.Export;

                if (cacheEncogExample != null)
                {
                    for (int idx = 0; idx < cacheEncogExample.Length; idx++)
                    {
                        if (cacheEncogExample[idx].Export == export && cacheEncogExample[idx].EqualsInput(input))
                        {
                            return(cacheEncogExample[idx]);
                        }
                    }
                }

                EncogExample indicator = new EncogExample();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input  = input;
                indicator.Export = export;
                Indicators.Add(indicator);
                indicator.SetUp();

                EncogExample[] tmp = new EncogExample[cacheEncogExample == null ? 1 : cacheEncogExample.Length + 1];
                if (cacheEncogExample != null)
                {
                    cacheEncogExample.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheEncogExample   = tmp;
                return(indicator);
            }
        }
        /// <summary>
        /// Richard Todd. Lets you draw with styles more easily.
        /// </summary>
        /// <returns></returns>
        public ZDrawOptions ZDrawOptions(Data.IDataSeries input, bool toggleSwitch)
        {
            if (cacheZDrawOptions != null)
            {
                for (int idx = 0; idx < cacheZDrawOptions.Length; idx++)
                {
                    if (cacheZDrawOptions[idx].ToggleSwitch == toggleSwitch && cacheZDrawOptions[idx].EqualsInput(input))
                    {
                        return(cacheZDrawOptions[idx]);
                    }
                }
            }

            lock (checkZDrawOptions)
            {
                checkZDrawOptions.ToggleSwitch = toggleSwitch;
                toggleSwitch = checkZDrawOptions.ToggleSwitch;

                if (cacheZDrawOptions != null)
                {
                    for (int idx = 0; idx < cacheZDrawOptions.Length; idx++)
                    {
                        if (cacheZDrawOptions[idx].ToggleSwitch == toggleSwitch && cacheZDrawOptions[idx].EqualsInput(input))
                        {
                            return(cacheZDrawOptions[idx]);
                        }
                    }
                }

                ZDrawOptions indicator = new ZDrawOptions();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input        = input;
                indicator.ToggleSwitch = toggleSwitch;
                Indicators.Add(indicator);
                indicator.SetUp();

                ZDrawOptions[] tmp = new ZDrawOptions[cacheZDrawOptions == null ? 1 : cacheZDrawOptions.Length + 1];
                if (cacheZDrawOptions != null)
                {
                    cacheZDrawOptions.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheZDrawOptions   = tmp;
                return(indicator);
            }
        }
Exemple #3
0
        /// <summary>
        /// The Exponential Moving Average is an indicator that shows the average value of a security's price over a period of time. When calculating a moving average. The EMA_Slope_Color applies more weight to recent prices than the SMA.
        /// </summary>
        /// <returns></returns>
        public SJC_PB_MA SJC_PB_MA(Data.IDataSeries input, int length)
        {
            if (cacheSJC_PB_MA != null)
            {
                for (int idx = 0; idx < cacheSJC_PB_MA.Length; idx++)
                {
                    if (cacheSJC_PB_MA[idx].Length == length && cacheSJC_PB_MA[idx].EqualsInput(input))
                    {
                        return(cacheSJC_PB_MA[idx]);
                    }
                }
            }

            lock (checkSJC_PB_MA)
            {
                checkSJC_PB_MA.Length = length;
                length = checkSJC_PB_MA.Length;

                if (cacheSJC_PB_MA != null)
                {
                    for (int idx = 0; idx < cacheSJC_PB_MA.Length; idx++)
                    {
                        if (cacheSJC_PB_MA[idx].Length == length && cacheSJC_PB_MA[idx].EqualsInput(input))
                        {
                            return(cacheSJC_PB_MA[idx]);
                        }
                    }
                }

                SJC_PB_MA indicator = new SJC_PB_MA();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input  = input;
                indicator.Length = length;
                Indicators.Add(indicator);
                indicator.SetUp();

                SJC_PB_MA[] tmp = new SJC_PB_MA[cacheSJC_PB_MA == null ? 1 : cacheSJC_PB_MA.Length + 1];
                if (cacheSJC_PB_MA != null)
                {
                    cacheSJC_PB_MA.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheSJC_PB_MA      = tmp;
                return(indicator);
            }
        }
Exemple #4
0
        /// <summary>
        /// Zero-Lagging TEMA
        /// </summary>
        /// <returns></returns>
        public ZeroLagTEMA ZeroLagTEMA(Data.IDataSeries input, int period)
        {
            if (cacheZeroLagTEMA != null)
            {
                for (int idx = 0; idx < cacheZeroLagTEMA.Length; idx++)
                {
                    if (cacheZeroLagTEMA[idx].Period == period && cacheZeroLagTEMA[idx].EqualsInput(input))
                    {
                        return(cacheZeroLagTEMA[idx]);
                    }
                }
            }

            lock (checkZeroLagTEMA)
            {
                checkZeroLagTEMA.Period = period;
                period = checkZeroLagTEMA.Period;

                if (cacheZeroLagTEMA != null)
                {
                    for (int idx = 0; idx < cacheZeroLagTEMA.Length; idx++)
                    {
                        if (cacheZeroLagTEMA[idx].Period == period && cacheZeroLagTEMA[idx].EqualsInput(input))
                        {
                            return(cacheZeroLagTEMA[idx]);
                        }
                    }
                }

                ZeroLagTEMA indicator = new ZeroLagTEMA();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input  = input;
                indicator.Period = period;
                Indicators.Add(indicator);
                indicator.SetUp();

                ZeroLagTEMA[] tmp = new ZeroLagTEMA[cacheZeroLagTEMA == null ? 1 : cacheZeroLagTEMA.Length + 1];
                if (cacheZeroLagTEMA != null)
                {
                    cacheZeroLagTEMA.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheZeroLagTEMA    = tmp;
                return(indicator);
            }
        }
        /// <summary>
        /// Base Recorder indicator class. Can be instantiated or not
        /// </summary>
        /// <returns></returns>
        public GomRecorderIndicator GomRecorderIndicator(Data.IDataSeries input, string fileFormat)
        {
            if (cacheGomRecorderIndicator != null)
            {
                for (int idx = 0; idx < cacheGomRecorderIndicator.Length; idx++)
                {
                    if (cacheGomRecorderIndicator[idx].FileFormat == fileFormat && cacheGomRecorderIndicator[idx].EqualsInput(input))
                    {
                        return(cacheGomRecorderIndicator[idx]);
                    }
                }
            }

            lock (checkGomRecorderIndicator)
            {
                checkGomRecorderIndicator.FileFormat = fileFormat;
                fileFormat = checkGomRecorderIndicator.FileFormat;

                if (cacheGomRecorderIndicator != null)
                {
                    for (int idx = 0; idx < cacheGomRecorderIndicator.Length; idx++)
                    {
                        if (cacheGomRecorderIndicator[idx].FileFormat == fileFormat && cacheGomRecorderIndicator[idx].EqualsInput(input))
                        {
                            return(cacheGomRecorderIndicator[idx]);
                        }
                    }
                }

                GomRecorderIndicator indicator = new GomRecorderIndicator();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input      = input;
                indicator.FileFormat = fileFormat;
                Indicators.Add(indicator);
                indicator.SetUp();

                GomRecorderIndicator[] tmp = new GomRecorderIndicator[cacheGomRecorderIndicator == null ? 1 : cacheGomRecorderIndicator.Length + 1];
                if (cacheGomRecorderIndicator != null)
                {
                    cacheGomRecorderIndicator.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1]       = indicator;
                cacheGomRecorderIndicator = tmp;
                return(indicator);
            }
        }
Exemple #6
0
        /// <summary>
        /// Gives the Slope of the Linear Regression
        /// </summary>
        /// <returns></returns>
        public UpTrendDownTrend UpTrendDownTrend(Data.IDataSeries input, int period)
        {
            if (cacheUpTrendDownTrend != null)
            {
                for (int idx = 0; idx < cacheUpTrendDownTrend.Length; idx++)
                {
                    if (cacheUpTrendDownTrend[idx].Period == period && cacheUpTrendDownTrend[idx].EqualsInput(input))
                    {
                        return(cacheUpTrendDownTrend[idx]);
                    }
                }
            }

            lock (checkUpTrendDownTrend)
            {
                checkUpTrendDownTrend.Period = period;
                period = checkUpTrendDownTrend.Period;

                if (cacheUpTrendDownTrend != null)
                {
                    for (int idx = 0; idx < cacheUpTrendDownTrend.Length; idx++)
                    {
                        if (cacheUpTrendDownTrend[idx].Period == period && cacheUpTrendDownTrend[idx].EqualsInput(input))
                        {
                            return(cacheUpTrendDownTrend[idx]);
                        }
                    }
                }

                UpTrendDownTrend indicator = new UpTrendDownTrend();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input  = input;
                indicator.Period = period;
                Indicators.Add(indicator);
                indicator.SetUp();

                UpTrendDownTrend[] tmp = new UpTrendDownTrend[cacheUpTrendDownTrend == null ? 1 : cacheUpTrendDownTrend.Length + 1];
                if (cacheUpTrendDownTrend != null)
                {
                    cacheUpTrendDownTrend.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1]   = indicator;
                cacheUpTrendDownTrend = tmp;
                return(indicator);
            }
        }
        /// <summary>
        /// Enter the description of your new custom indicator here
        /// </summary>
        /// <returns></returns>
        public ZZDataCollector ZZDataCollector(Data.IDataSeries input, string fileName)
        {
            if (cacheZZDataCollector != null)
            {
                for (int idx = 0; idx < cacheZZDataCollector.Length; idx++)
                {
                    if (cacheZZDataCollector[idx].FileName == fileName && cacheZZDataCollector[idx].EqualsInput(input))
                    {
                        return(cacheZZDataCollector[idx]);
                    }
                }
            }

            lock (checkZZDataCollector)
            {
                checkZZDataCollector.FileName = fileName;
                fileName = checkZZDataCollector.FileName;

                if (cacheZZDataCollector != null)
                {
                    for (int idx = 0; idx < cacheZZDataCollector.Length; idx++)
                    {
                        if (cacheZZDataCollector[idx].FileName == fileName && cacheZZDataCollector[idx].EqualsInput(input))
                        {
                            return(cacheZZDataCollector[idx]);
                        }
                    }
                }

                ZZDataCollector indicator = new ZZDataCollector();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input    = input;
                indicator.FileName = fileName;
                Indicators.Add(indicator);
                indicator.SetUp();

                ZZDataCollector[] tmp = new ZZDataCollector[cacheZZDataCollector == null ? 1 : cacheZZDataCollector.Length + 1];
                if (cacheZZDataCollector != null)
                {
                    cacheZZDataCollector.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1]  = indicator;
                cacheZZDataCollector = tmp;
                return(indicator);
            }
        }
        /// <summary>
        /// TSSuperTrend Indicator developed by TradingStudies.com (Vertsion 2.3)
        /// </summary>
        /// <returns></returns>
        public TSSuperTrend TSSuperTrend(Data.IDataSeries input, int length, MovingAverageType maType, double multiplier, int smooth, SuperTrendMode stMode)
        {
            if (cacheTSSuperTrend != null)
                for (int idx = 0; idx < cacheTSSuperTrend.Length; idx++)
                    if (cacheTSSuperTrend[idx].Length == length && cacheTSSuperTrend[idx].MaType == maType && Math.Abs(cacheTSSuperTrend[idx].Multiplier - multiplier) <= double.Epsilon && cacheTSSuperTrend[idx].Smooth == smooth && cacheTSSuperTrend[idx].StMode == stMode && cacheTSSuperTrend[idx].EqualsInput(input))
                        return cacheTSSuperTrend[idx];

            lock (checkTSSuperTrend)
            {
                checkTSSuperTrend.Length = length;
                length = checkTSSuperTrend.Length;
                checkTSSuperTrend.MaType = maType;
                maType = checkTSSuperTrend.MaType;
                checkTSSuperTrend.Multiplier = multiplier;
                multiplier = checkTSSuperTrend.Multiplier;
                checkTSSuperTrend.Smooth = smooth;
                smooth = checkTSSuperTrend.Smooth;
                checkTSSuperTrend.StMode = stMode;
                stMode = checkTSSuperTrend.StMode;

                if (cacheTSSuperTrend != null)
                    for (int idx = 0; idx < cacheTSSuperTrend.Length; idx++)
                        if (cacheTSSuperTrend[idx].Length == length && cacheTSSuperTrend[idx].MaType == maType && Math.Abs(cacheTSSuperTrend[idx].Multiplier - multiplier) <= double.Epsilon && cacheTSSuperTrend[idx].Smooth == smooth && cacheTSSuperTrend[idx].StMode == stMode && cacheTSSuperTrend[idx].EqualsInput(input))
                            return cacheTSSuperTrend[idx];

                TSSuperTrend indicator = new TSSuperTrend();
                indicator.BarsRequired = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                indicator.Length = length;
                indicator.MaType = maType;
                indicator.Multiplier = multiplier;
                indicator.Smooth = smooth;
                indicator.StMode = stMode;
                Indicators.Add(indicator);
                indicator.SetUp();

                TSSuperTrend[] tmp = new TSSuperTrend[cacheTSSuperTrend == null ? 1 : cacheTSSuperTrend.Length + 1];
                if (cacheTSSuperTrend != null)
                    cacheTSSuperTrend.CopyTo(tmp, 0);
                tmp[tmp.Length - 1] = indicator;
                cacheTSSuperTrend = tmp;
                return indicator;
            }
        }
        /// <summary>
        /// Plots the open, high, low and close values from the session starting on the prior day.
        /// </summary>
        /// <returns></returns>
        public PriorDayOHLC PriorDayOHLC(Data.IDataSeries input)
        {
            if (cachePriorDayOHLC != null)
            {
                for (int idx = 0; idx < cachePriorDayOHLC.Length; idx++)
                {
                    if (cachePriorDayOHLC[idx].EqualsInput(input))
                    {
                        return(cachePriorDayOHLC[idx]);
                    }
                }
            }

            lock (checkPriorDayOHLC)
            {
                if (cachePriorDayOHLC != null)
                {
                    for (int idx = 0; idx < cachePriorDayOHLC.Length; idx++)
                    {
                        if (cachePriorDayOHLC[idx].EqualsInput(input))
                        {
                            return(cachePriorDayOHLC[idx]);
                        }
                    }
                }

                PriorDayOHLC indicator = new PriorDayOHLC();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                Indicators.Add(indicator);
                indicator.SetUp();

                PriorDayOHLC[] tmp = new PriorDayOHLC[cachePriorDayOHLC == null ? 1 : cachePriorDayOHLC.Length + 1];
                if (cachePriorDayOHLC != null)
                {
                    cachePriorDayOHLC.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cachePriorDayOHLC   = tmp;
                return(indicator);
            }
        }
        /// <summary>
        /// Enter the description of your new custom indicator here
        /// </summary>
        /// <returns></returns>
        public kEconData kEconData(Data.IDataSeries input)
        {
            if (cachekEconData != null)
            {
                for (int idx = 0; idx < cachekEconData.Length; idx++)
                {
                    if (cachekEconData[idx].EqualsInput(input))
                    {
                        return(cachekEconData[idx]);
                    }
                }
            }

            lock (checkkEconData)
            {
                if (cachekEconData != null)
                {
                    for (int idx = 0; idx < cachekEconData.Length; idx++)
                    {
                        if (cachekEconData[idx].EqualsInput(input))
                        {
                            return(cachekEconData[idx]);
                        }
                    }
                }

                kEconData indicator = new kEconData();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                Indicators.Add(indicator);
                indicator.SetUp();

                kEconData[] tmp = new kEconData[cachekEconData == null ? 1 : cachekEconData.Length + 1];
                if (cachekEconData != null)
                {
                    cachekEconData.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cachekEconData      = tmp;
                return(indicator);
            }
        }
Exemple #11
0
        /// <summary>
        /// HeikenAshi technique discussed in the article 'Using Heiken-Ashi Technique' in February 2004 issue of TASC magazine.
        /// </summary>
        /// <returns></returns>
        public HeikenAshi HeikenAshi(Data.IDataSeries input)
        {
            if (cacheHeikenAshi != null)
            {
                for (int idx = 0; idx < cacheHeikenAshi.Length; idx++)
                {
                    if (cacheHeikenAshi[idx].EqualsInput(input))
                    {
                        return(cacheHeikenAshi[idx]);
                    }
                }
            }

            lock (checkHeikenAshi)
            {
                if (cacheHeikenAshi != null)
                {
                    for (int idx = 0; idx < cacheHeikenAshi.Length; idx++)
                    {
                        if (cacheHeikenAshi[idx].EqualsInput(input))
                        {
                            return(cacheHeikenAshi[idx]);
                        }
                    }
                }

                HeikenAshi indicator = new HeikenAshi();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                Indicators.Add(indicator);
                indicator.SetUp();

                HeikenAshi[] tmp = new HeikenAshi[cacheHeikenAshi == null ? 1 : cacheHeikenAshi.Length + 1];
                if (cacheHeikenAshi != null)
                {
                    cacheHeikenAshi.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheHeikenAshi     = tmp;
                return(indicator);
            }
        }
        /// <summary>
        /// Enter the description of your new custom indicator here
        /// </summary>
        /// <returns></returns>
        public GomDeltaMomentum GomDeltaMomentum(Data.IDataSeries input)
        {
            if (cacheGomDeltaMomentum != null)
            {
                for (int idx = 0; idx < cacheGomDeltaMomentum.Length; idx++)
                {
                    if (cacheGomDeltaMomentum[idx].EqualsInput(input))
                    {
                        return(cacheGomDeltaMomentum[idx]);
                    }
                }
            }

            lock (checkGomDeltaMomentum)
            {
                if (cacheGomDeltaMomentum != null)
                {
                    for (int idx = 0; idx < cacheGomDeltaMomentum.Length; idx++)
                    {
                        if (cacheGomDeltaMomentum[idx].EqualsInput(input))
                        {
                            return(cacheGomDeltaMomentum[idx]);
                        }
                    }
                }

                GomDeltaMomentum indicator = new GomDeltaMomentum();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                Indicators.Add(indicator);
                indicator.SetUp();

                GomDeltaMomentum[] tmp = new GomDeltaMomentum[cacheGomDeltaMomentum == null ? 1 : cacheGomDeltaMomentum.Length + 1];
                if (cacheGomDeltaMomentum != null)
                {
                    cacheGomDeltaMomentum.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1]   = indicator;
                cacheGomDeltaMomentum = tmp;
                return(indicator);
            }
        }
Exemple #13
0
        /// <summary>
        /// Enter the description of your new custom indicator here
        /// </summary>
        /// <returns></returns>
        public Tick2MinAnalysis Tick2MinAnalysis(Data.IDataSeries input)
        {
            if (cacheTick2MinAnalysis != null)
            {
                for (int idx = 0; idx < cacheTick2MinAnalysis.Length; idx++)
                {
                    if (cacheTick2MinAnalysis[idx].EqualsInput(input))
                    {
                        return(cacheTick2MinAnalysis[idx]);
                    }
                }
            }

            lock (checkTick2MinAnalysis)
            {
                if (cacheTick2MinAnalysis != null)
                {
                    for (int idx = 0; idx < cacheTick2MinAnalysis.Length; idx++)
                    {
                        if (cacheTick2MinAnalysis[idx].EqualsInput(input))
                        {
                            return(cacheTick2MinAnalysis[idx]);
                        }
                    }
                }

                Tick2MinAnalysis indicator = new Tick2MinAnalysis();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                Indicators.Add(indicator);
                indicator.SetUp();

                Tick2MinAnalysis[] tmp = new Tick2MinAnalysis[cacheTick2MinAnalysis == null ? 1 : cacheTick2MinAnalysis.Length + 1];
                if (cacheTick2MinAnalysis != null)
                {
                    cacheTick2MinAnalysis.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1]   = indicator;
                cacheTick2MinAnalysis = tmp;
                return(indicator);
            }
        }
        /// <summary>
        /// Enter the description of your new custom indicator here
        /// </summary>
        /// <returns></returns>
        public matlabTradeReportIndicator matlabTradeReportIndicator(Data.IDataSeries input)
        {
            if (cachematlabTradeReportIndicator != null)
            {
                for (int idx = 0; idx < cachematlabTradeReportIndicator.Length; idx++)
                {
                    if (cachematlabTradeReportIndicator[idx].EqualsInput(input))
                    {
                        return(cachematlabTradeReportIndicator[idx]);
                    }
                }
            }

            lock (checkmatlabTradeReportIndicator)
            {
                if (cachematlabTradeReportIndicator != null)
                {
                    for (int idx = 0; idx < cachematlabTradeReportIndicator.Length; idx++)
                    {
                        if (cachematlabTradeReportIndicator[idx].EqualsInput(input))
                        {
                            return(cachematlabTradeReportIndicator[idx]);
                        }
                    }
                }

                matlabTradeReportIndicator indicator = new matlabTradeReportIndicator();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                Indicators.Add(indicator);
                indicator.SetUp();

                matlabTradeReportIndicator[] tmp = new matlabTradeReportIndicator[cachematlabTradeReportIndicator == null ? 1 : cachematlabTradeReportIndicator.Length + 1];
                if (cachematlabTradeReportIndicator != null)
                {
                    cachematlabTradeReportIndicator.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1]             = indicator;
                cachematlabTradeReportIndicator = tmp;
                return(indicator);
            }
        }
Exemple #15
0
        /// <summary>
        /// Indicator  to show the difference between bid and ask trades on each bar
        /// </summary>
        /// <returns></returns>
        public VolumeBidAsk VolumeBidAsk(Data.IDataSeries input)
        {
            if (cacheVolumeBidAsk != null)
            {
                for (int idx = 0; idx < cacheVolumeBidAsk.Length; idx++)
                {
                    if (cacheVolumeBidAsk[idx].EqualsInput(input))
                    {
                        return(cacheVolumeBidAsk[idx]);
                    }
                }
            }

            lock (checkVolumeBidAsk)
            {
                if (cacheVolumeBidAsk != null)
                {
                    for (int idx = 0; idx < cacheVolumeBidAsk.Length; idx++)
                    {
                        if (cacheVolumeBidAsk[idx].EqualsInput(input))
                        {
                            return(cacheVolumeBidAsk[idx]);
                        }
                    }
                }

                VolumeBidAsk indicator = new VolumeBidAsk();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                Indicators.Add(indicator);
                indicator.SetUp();

                VolumeBidAsk[] tmp = new VolumeBidAsk[cacheVolumeBidAsk == null ? 1 : cacheVolumeBidAsk.Length + 1];
                if (cacheVolumeBidAsk != null)
                {
                    cacheVolumeBidAsk.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheVolumeBidAsk   = tmp;
                return(indicator);
            }
        }
Exemple #16
0
        /// <summary>
        /// Calculates the range of a bar.
        /// </summary>
        /// <returns></returns>
        public Range Range(Data.IDataSeries input)
        {
            if (cacheRange != null)
            {
                for (int idx = 0; idx < cacheRange.Length; idx++)
                {
                    if (cacheRange[idx].EqualsInput(input))
                    {
                        return(cacheRange[idx]);
                    }
                }
            }

            lock (checkRange)
            {
                if (cacheRange != null)
                {
                    for (int idx = 0; idx < cacheRange.Length; idx++)
                    {
                        if (cacheRange[idx].EqualsInput(input))
                        {
                            return(cacheRange[idx]);
                        }
                    }
                }

                Range indicator = new Range();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                Indicators.Add(indicator);
                indicator.SetUp();

                Range[] tmp = new Range[cacheRange == null ? 1 : cacheRange.Length + 1];
                if (cacheRange != null)
                {
                    cacheRange.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheRange          = tmp;
                return(indicator);
            }
        }
        /// <summary>
        /// Enter the description of your new custom indicator here
        /// </summary>
        /// <returns></returns>
        public CSharpThread CSharpThread(Data.IDataSeries input)
        {
            if (cacheCSharpThread != null)
            {
                for (int idx = 0; idx < cacheCSharpThread.Length; idx++)
                {
                    if (cacheCSharpThread[idx].EqualsInput(input))
                    {
                        return(cacheCSharpThread[idx]);
                    }
                }
            }

            lock (checkCSharpThread)
            {
                if (cacheCSharpThread != null)
                {
                    for (int idx = 0; idx < cacheCSharpThread.Length; idx++)
                    {
                        if (cacheCSharpThread[idx].EqualsInput(input))
                        {
                            return(cacheCSharpThread[idx]);
                        }
                    }
                }

                CSharpThread indicator = new CSharpThread();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                Indicators.Add(indicator);
                indicator.SetUp();

                CSharpThread[] tmp = new CSharpThread[cacheCSharpThread == null ? 1 : cacheCSharpThread.Length + 1];
                if (cacheCSharpThread != null)
                {
                    cacheCSharpThread.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheCSharpThread   = tmp;
                return(indicator);
            }
        }
Exemple #18
0
        /// <summary>
        /// ThreeBarReversal
        /// </summary>
        /// <returns></returns>
        public ThreeBarReversal ThreeBarReversal(Data.IDataSeries input)
        {
            if (cacheThreeBarReversal != null)
            {
                for (int idx = 0; idx < cacheThreeBarReversal.Length; idx++)
                {
                    if (cacheThreeBarReversal[idx].EqualsInput(input))
                    {
                        return(cacheThreeBarReversal[idx]);
                    }
                }
            }

            lock (checkThreeBarReversal)
            {
                if (cacheThreeBarReversal != null)
                {
                    for (int idx = 0; idx < cacheThreeBarReversal.Length; idx++)
                    {
                        if (cacheThreeBarReversal[idx].EqualsInput(input))
                        {
                            return(cacheThreeBarReversal[idx]);
                        }
                    }
                }

                ThreeBarReversal indicator = new ThreeBarReversal();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                Indicators.Add(indicator);
                indicator.SetUp();

                ThreeBarReversal[] tmp = new ThreeBarReversal[cacheThreeBarReversal == null ? 1 : cacheThreeBarReversal.Length + 1];
                if (cacheThreeBarReversal != null)
                {
                    cacheThreeBarReversal.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1]   = indicator;
                cacheThreeBarReversal = tmp;
                return(indicator);
            }
        }
Exemple #19
0
        /// <summary>
        /// Gom Delta Multiplier
        /// </summary>
        /// <returns></returns>
        public DeltaXalert DeltaXalert(Data.IDataSeries input)
        {
            if (cacheDeltaXalert != null)
            {
                for (int idx = 0; idx < cacheDeltaXalert.Length; idx++)
                {
                    if (cacheDeltaXalert[idx].EqualsInput(input))
                    {
                        return(cacheDeltaXalert[idx]);
                    }
                }
            }

            lock (checkDeltaXalert)
            {
                if (cacheDeltaXalert != null)
                {
                    for (int idx = 0; idx < cacheDeltaXalert.Length; idx++)
                    {
                        if (cacheDeltaXalert[idx].EqualsInput(input))
                        {
                            return(cacheDeltaXalert[idx]);
                        }
                    }
                }

                DeltaXalert indicator = new DeltaXalert();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                Indicators.Add(indicator);
                indicator.SetUp();

                DeltaXalert[] tmp = new DeltaXalert[cacheDeltaXalert == null ? 1 : cacheDeltaXalert.Length + 1];
                if (cacheDeltaXalert != null)
                {
                    cacheDeltaXalert.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheDeltaXalert    = tmp;
                return(indicator);
            }
        }
Exemple #20
0
        /// <summary>
        /// Sample demonstrating how you can create your own Level II data book.
        /// </summary>
        /// <returns></returns>
        public SampleMarketDepth SampleMarketDepth(Data.IDataSeries input)
        {
            if (cacheSampleMarketDepth != null)
            {
                for (int idx = 0; idx < cacheSampleMarketDepth.Length; idx++)
                {
                    if (cacheSampleMarketDepth[idx].EqualsInput(input))
                    {
                        return(cacheSampleMarketDepth[idx]);
                    }
                }
            }

            lock (checkSampleMarketDepth)
            {
                if (cacheSampleMarketDepth != null)
                {
                    for (int idx = 0; idx < cacheSampleMarketDepth.Length; idx++)
                    {
                        if (cacheSampleMarketDepth[idx].EqualsInput(input))
                        {
                            return(cacheSampleMarketDepth[idx]);
                        }
                    }
                }

                SampleMarketDepth indicator = new SampleMarketDepth();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                Indicators.Add(indicator);
                indicator.SetUp();

                SampleMarketDepth[] tmp = new SampleMarketDepth[cacheSampleMarketDepth == null ? 1 : cacheSampleMarketDepth.Length + 1];
                if (cacheSampleMarketDepth != null)
                {
                    cacheSampleMarketDepth.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1]    = indicator;
                cacheSampleMarketDepth = tmp;
                return(indicator);
            }
        }
Exemple #21
0
        /// <summary>
        /// Enter the description of your new custom indicator here
        /// </summary>
        /// <returns></returns>
        public overlayCOT overlayCOT(Data.IDataSeries input)
        {
            if (cacheoverlayCOT != null)
            {
                for (int idx = 0; idx < cacheoverlayCOT.Length; idx++)
                {
                    if (cacheoverlayCOT[idx].EqualsInput(input))
                    {
                        return(cacheoverlayCOT[idx]);
                    }
                }
            }

            lock (checkoverlayCOT)
            {
                if (cacheoverlayCOT != null)
                {
                    for (int idx = 0; idx < cacheoverlayCOT.Length; idx++)
                    {
                        if (cacheoverlayCOT[idx].EqualsInput(input))
                        {
                            return(cacheoverlayCOT[idx]);
                        }
                    }
                }

                overlayCOT indicator = new overlayCOT();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                Indicators.Add(indicator);
                indicator.SetUp();

                overlayCOT[] tmp = new overlayCOT[cacheoverlayCOT == null ? 1 : cacheoverlayCOT.Length + 1];
                if (cacheoverlayCOT != null)
                {
                    cacheoverlayCOT.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheoverlayCOT     = tmp;
                return(indicator);
            }
        }
        /// <summary>
        /// Plots the open, high, and low values from the session starting on the current day.
        /// </summary>
        /// <returns></returns>
        public CurrentDayOHL CurrentDayOHL(Data.IDataSeries input)
        {
            if (cacheCurrentDayOHL != null)
            {
                for (int idx = 0; idx < cacheCurrentDayOHL.Length; idx++)
                {
                    if (cacheCurrentDayOHL[idx].EqualsInput(input))
                    {
                        return(cacheCurrentDayOHL[idx]);
                    }
                }
            }

            lock (checkCurrentDayOHL)
            {
                if (cacheCurrentDayOHL != null)
                {
                    for (int idx = 0; idx < cacheCurrentDayOHL.Length; idx++)
                    {
                        if (cacheCurrentDayOHL[idx].EqualsInput(input))
                        {
                            return(cacheCurrentDayOHL[idx]);
                        }
                    }
                }

                CurrentDayOHL indicator = new CurrentDayOHL();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                Indicators.Add(indicator);
                indicator.SetUp();

                CurrentDayOHL[] tmp = new CurrentDayOHL[cacheCurrentDayOHL == null ? 1 : cacheCurrentDayOHL.Length + 1];
                if (cacheCurrentDayOHL != null)
                {
                    cacheCurrentDayOHL.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheCurrentDayOHL  = tmp;
                return(indicator);
            }
        }
        /// <summary>
        /// MicroTrends.Indicator.DoubleShotStrategyInfoBar Strategy Info bar
        /// </summary>
        /// <returns></returns>
        public MTDoubleShotStrategyInfoBar MTDoubleShotStrategyInfoBar(Data.IDataSeries input)
        {
            if (cacheMTDoubleShotStrategyInfoBar != null)
            {
                for (int idx = 0; idx < cacheMTDoubleShotStrategyInfoBar.Length; idx++)
                {
                    if (cacheMTDoubleShotStrategyInfoBar[idx].EqualsInput(input))
                    {
                        return(cacheMTDoubleShotStrategyInfoBar[idx]);
                    }
                }
            }

            lock (checkMTDoubleShotStrategyInfoBar)
            {
                if (cacheMTDoubleShotStrategyInfoBar != null)
                {
                    for (int idx = 0; idx < cacheMTDoubleShotStrategyInfoBar.Length; idx++)
                    {
                        if (cacheMTDoubleShotStrategyInfoBar[idx].EqualsInput(input))
                        {
                            return(cacheMTDoubleShotStrategyInfoBar[idx]);
                        }
                    }
                }

                MTDoubleShotStrategyInfoBar indicator = new MTDoubleShotStrategyInfoBar();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                Indicators.Add(indicator);
                indicator.SetUp();

                MTDoubleShotStrategyInfoBar[] tmp = new MTDoubleShotStrategyInfoBar[cacheMTDoubleShotStrategyInfoBar == null ? 1 : cacheMTDoubleShotStrategyInfoBar.Length + 1];
                if (cacheMTDoubleShotStrategyInfoBar != null)
                {
                    cacheMTDoubleShotStrategyInfoBar.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheMTDoubleShotStrategyInfoBar = tmp;
                return(indicator);
            }
        }
        /// <summary>
        /// Enter the description of your new custom indicator here
        /// </summary>
        /// <returns></returns>
        public BarsSinceSession BarsSinceSession(Data.IDataSeries input)
        {
            if (cacheBarsSinceSession != null)
            {
                for (int idx = 0; idx < cacheBarsSinceSession.Length; idx++)
                {
                    if (cacheBarsSinceSession[idx].EqualsInput(input))
                    {
                        return(cacheBarsSinceSession[idx]);
                    }
                }
            }

            lock (checkBarsSinceSession)
            {
                if (cacheBarsSinceSession != null)
                {
                    for (int idx = 0; idx < cacheBarsSinceSession.Length; idx++)
                    {
                        if (cacheBarsSinceSession[idx].EqualsInput(input))
                        {
                            return(cacheBarsSinceSession[idx]);
                        }
                    }
                }

                BarsSinceSession indicator = new BarsSinceSession();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                Indicators.Add(indicator);
                indicator.SetUp();

                BarsSinceSession[] tmp = new BarsSinceSession[cacheBarsSinceSession == null ? 1 : cacheBarsSinceSession.Length + 1];
                if (cacheBarsSinceSession != null)
                {
                    cacheBarsSinceSession.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1]   = indicator;
                cacheBarsSinceSession = tmp;
                return(indicator);
            }
        }
Exemple #25
0
        /// <summary>
        /// This indicator combines the SMI and the Trader's Dynamic Index into one that will generate a user selected device when the two line up.
        /// </summary>
        /// <returns></returns>
        public SMTDIndex SMTDIndex(Data.IDataSeries input)
        {
            if (cacheSMTDIndex != null)
            {
                for (int idx = 0; idx < cacheSMTDIndex.Length; idx++)
                {
                    if (cacheSMTDIndex[idx].EqualsInput(input))
                    {
                        return(cacheSMTDIndex[idx]);
                    }
                }
            }

            lock (checkSMTDIndex)
            {
                if (cacheSMTDIndex != null)
                {
                    for (int idx = 0; idx < cacheSMTDIndex.Length; idx++)
                    {
                        if (cacheSMTDIndex[idx].EqualsInput(input))
                        {
                            return(cacheSMTDIndex[idx]);
                        }
                    }
                }

                SMTDIndex indicator = new SMTDIndex();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                Indicators.Add(indicator);
                indicator.SetUp();

                SMTDIndex[] tmp = new SMTDIndex[cacheSMTDIndex == null ? 1 : cacheSMTDIndex.Length + 1];
                if (cacheSMTDIndex != null)
                {
                    cacheSMTDIndex.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheSMTDIndex      = tmp;
                return(indicator);
            }
        }
        /// <summary>
        /// Tick per Second MAX
        /// </summary>
        /// <returns></returns>
        public TicksPerSecond_MAX_Counter_v1 TicksPerSecond_MAX_Counter_v1(Data.IDataSeries input)
        {
            if (cacheTicksPerSecond_MAX_Counter_v1 != null)
            {
                for (int idx = 0; idx < cacheTicksPerSecond_MAX_Counter_v1.Length; idx++)
                {
                    if (cacheTicksPerSecond_MAX_Counter_v1[idx].EqualsInput(input))
                    {
                        return(cacheTicksPerSecond_MAX_Counter_v1[idx]);
                    }
                }
            }

            lock (checkTicksPerSecond_MAX_Counter_v1)
            {
                if (cacheTicksPerSecond_MAX_Counter_v1 != null)
                {
                    for (int idx = 0; idx < cacheTicksPerSecond_MAX_Counter_v1.Length; idx++)
                    {
                        if (cacheTicksPerSecond_MAX_Counter_v1[idx].EqualsInput(input))
                        {
                            return(cacheTicksPerSecond_MAX_Counter_v1[idx]);
                        }
                    }
                }

                TicksPerSecond_MAX_Counter_v1 indicator = new TicksPerSecond_MAX_Counter_v1();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                Indicators.Add(indicator);
                indicator.SetUp();

                TicksPerSecond_MAX_Counter_v1[] tmp = new TicksPerSecond_MAX_Counter_v1[cacheTicksPerSecond_MAX_Counter_v1 == null ? 1 : cacheTicksPerSecond_MAX_Counter_v1.Length + 1];
                if (cacheTicksPerSecond_MAX_Counter_v1 != null)
                {
                    cacheTicksPerSecond_MAX_Counter_v1.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheTicksPerSecond_MAX_Counter_v1 = tmp;
                return(indicator);
            }
        }
        /// <summary>
        /// The price proxy
        /// </summary>
        /// <returns></returns>
        public Z20090722PriceProxy Z20090722PriceProxy(Data.IDataSeries input, Colorizer3Method colorMethod, double colorParam, int lookback, int tolerance, int windowLength)
        {
            checkZ20090722PriceProxy.ColorMethod = colorMethod;
            colorMethod = checkZ20090722PriceProxy.ColorMethod;
            checkZ20090722PriceProxy.ColorParam = colorParam;
            colorParam = checkZ20090722PriceProxy.ColorParam;
            checkZ20090722PriceProxy.Lookback = lookback;
            lookback = checkZ20090722PriceProxy.Lookback;
            checkZ20090722PriceProxy.Tolerance = tolerance;
            tolerance = checkZ20090722PriceProxy.Tolerance;
            checkZ20090722PriceProxy.WindowLength = windowLength;
            windowLength = checkZ20090722PriceProxy.WindowLength;

            if (cacheZ20090722PriceProxy != null)
            {
                for (int idx = 0; idx < cacheZ20090722PriceProxy.Length; idx++)
                {
                    if (cacheZ20090722PriceProxy[idx].ColorMethod == colorMethod && Math.Abs(cacheZ20090722PriceProxy[idx].ColorParam - colorParam) <= double.Epsilon && cacheZ20090722PriceProxy[idx].Lookback == lookback && cacheZ20090722PriceProxy[idx].Tolerance == tolerance && cacheZ20090722PriceProxy[idx].WindowLength == windowLength && cacheZ20090722PriceProxy[idx].EqualsInput(input))
                    {
                        return(cacheZ20090722PriceProxy[idx]);
                    }
                }
            }

            Z20090722PriceProxy indicator = new Z20090722PriceProxy();

            indicator.BarsRequired        = BarsRequired;
            indicator.CalculateOnBarClose = CalculateOnBarClose;
            indicator.Input        = input;
            indicator.ColorMethod  = colorMethod;
            indicator.ColorParam   = colorParam;
            indicator.Lookback     = lookback;
            indicator.Tolerance    = tolerance;
            indicator.WindowLength = windowLength;
            indicator.SetUp();

            Z20090722PriceProxy[] tmp = new Z20090722PriceProxy[cacheZ20090722PriceProxy == null ? 1 : cacheZ20090722PriceProxy.Length + 1];
            if (cacheZ20090722PriceProxy != null)
            {
                cacheZ20090722PriceProxy.CopyTo(tmp, 0);
            }
            tmp[tmp.Length - 1]      = indicator;
            cacheZ20090722PriceProxy = tmp;
            Indicators.Add(indicator);

            return(indicator);
        }
Exemple #28
0
        /// <summary>
        /// MACD of independent MA types
        /// </summary>
        /// <returns></returns>
        public zMaMacd zMaMacd(Data.IDataSeries input, RWT_MA.MAType aType1, RWT_MA.MAType aType2, double len1, double len2)
        {
            if (cachezMaMacd != null)
                for (int idx = 0; idx < cachezMaMacd.Length; idx++)
                    if (cachezMaMacd[idx].AType1 == aType1 && cachezMaMacd[idx].AType2 == aType2 && Math.Abs(cachezMaMacd[idx].Len1 - len1) <= double.Epsilon && Math.Abs(cachezMaMacd[idx].Len2 - len2) <= double.Epsilon && cachezMaMacd[idx].EqualsInput(input))
                        return cachezMaMacd[idx];

            lock (checkzMaMacd)
            {
                checkzMaMacd.AType1 = aType1;
                aType1 = checkzMaMacd.AType1;
                checkzMaMacd.AType2 = aType2;
                aType2 = checkzMaMacd.AType2;
                checkzMaMacd.Len1 = len1;
                len1 = checkzMaMacd.Len1;
                checkzMaMacd.Len2 = len2;
                len2 = checkzMaMacd.Len2;

                if (cachezMaMacd != null)
                    for (int idx = 0; idx < cachezMaMacd.Length; idx++)
                        if (cachezMaMacd[idx].AType1 == aType1 && cachezMaMacd[idx].AType2 == aType2 && Math.Abs(cachezMaMacd[idx].Len1 - len1) <= double.Epsilon && Math.Abs(cachezMaMacd[idx].Len2 - len2) <= double.Epsilon && cachezMaMacd[idx].EqualsInput(input))
                            return cachezMaMacd[idx];

                zMaMacd indicator = new zMaMacd();
                indicator.BarsRequired = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                indicator.AType1 = aType1;
                indicator.AType2 = aType2;
                indicator.Len1 = len1;
                indicator.Len2 = len2;
                Indicators.Add(indicator);
                indicator.SetUp();

                zMaMacd[] tmp = new zMaMacd[cachezMaMacd == null ? 1 : cachezMaMacd.Length + 1];
                if (cachezMaMacd != null)
                    cachezMaMacd.CopyTo(tmp, 0);
                tmp[tmp.Length - 1] = indicator;
                cachezMaMacd = tmp;
                return indicator;
            }
        }
Exemple #29
0
        /// <summary>
        /// Enter the description of your new custom indicator here
        /// </summary>
        /// <returns></returns>
        public SJCRSU SJCRSU(Data.IDataSeries input, double period1, double period2, double period3)
        {
            if (cacheSJCRSU != null)
                for (int idx = 0; idx < cacheSJCRSU.Length; idx++)
                    if (Math.Abs(cacheSJCRSU[idx].Period1 - period1) <= double.Epsilon && Math.Abs(cacheSJCRSU[idx].Period2 - period2) <= double.Epsilon && Math.Abs(cacheSJCRSU[idx].Period3 - period3) <= double.Epsilon && cacheSJCRSU[idx].EqualsInput(input))
                        return cacheSJCRSU[idx];

            lock (checkSJCRSU)
            {
                checkSJCRSU.Period1 = period1;
                period1 = checkSJCRSU.Period1;
                checkSJCRSU.Period2 = period2;
                period2 = checkSJCRSU.Period2;
                checkSJCRSU.Period3 = period3;
                period3 = checkSJCRSU.Period3;

                if (cacheSJCRSU != null)
                    for (int idx = 0; idx < cacheSJCRSU.Length; idx++)
                        if (Math.Abs(cacheSJCRSU[idx].Period1 - period1) <= double.Epsilon && Math.Abs(cacheSJCRSU[idx].Period2 - period2) <= double.Epsilon && Math.Abs(cacheSJCRSU[idx].Period3 - period3) <= double.Epsilon && cacheSJCRSU[idx].EqualsInput(input))
                            return cacheSJCRSU[idx];

                SJCRSU indicator = new SJCRSU();
                indicator.BarsRequired = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                indicator.Period1 = period1;
                indicator.Period2 = period2;
                indicator.Period3 = period3;
                Indicators.Add(indicator);
                indicator.SetUp();

                SJCRSU[] tmp = new SJCRSU[cacheSJCRSU == null ? 1 : cacheSJCRSU.Length + 1];
                if (cacheSJCRSU != null)
                    cacheSJCRSU.CopyTo(tmp, 0);
                tmp[tmp.Length - 1] = indicator;
                cacheSJCRSU = tmp;
                return indicator;
            }
        }
        /// <summary>
        /// Empty placeholder indicator for creating plots in NinjaScript Strategies
        /// </summary>
        /// <returns></returns>
        public TCStrategyPlotMulti TCStrategyPlotMulti(Data.IDataSeries input, int id, int numberOfPlots, bool overlayMode)
        {
            if (cacheTCStrategyPlotMulti != null)
                for (int idx = 0; idx < cacheTCStrategyPlotMulti.Length; idx++)
                    if (cacheTCStrategyPlotMulti[idx].Id == id && cacheTCStrategyPlotMulti[idx].NumberOfPlots == numberOfPlots && cacheTCStrategyPlotMulti[idx].OverlayMode == overlayMode && cacheTCStrategyPlotMulti[idx].EqualsInput(input))
                        return cacheTCStrategyPlotMulti[idx];

            lock (checkTCStrategyPlotMulti)
            {
                checkTCStrategyPlotMulti.Id = id;
                id = checkTCStrategyPlotMulti.Id;
                checkTCStrategyPlotMulti.NumberOfPlots = numberOfPlots;
                numberOfPlots = checkTCStrategyPlotMulti.NumberOfPlots;
                checkTCStrategyPlotMulti.OverlayMode = overlayMode;
                overlayMode = checkTCStrategyPlotMulti.OverlayMode;

                if (cacheTCStrategyPlotMulti != null)
                    for (int idx = 0; idx < cacheTCStrategyPlotMulti.Length; idx++)
                        if (cacheTCStrategyPlotMulti[idx].Id == id && cacheTCStrategyPlotMulti[idx].NumberOfPlots == numberOfPlots && cacheTCStrategyPlotMulti[idx].OverlayMode == overlayMode && cacheTCStrategyPlotMulti[idx].EqualsInput(input))
                            return cacheTCStrategyPlotMulti[idx];

                TCStrategyPlotMulti indicator = new TCStrategyPlotMulti();
                indicator.BarsRequired = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
            #if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack = MaximumBarsLookBack;
            #endif
                indicator.Input = input;
                indicator.Id = id;
                indicator.NumberOfPlots = numberOfPlots;
                indicator.OverlayMode = overlayMode;
                Indicators.Add(indicator);
                indicator.SetUp();

                TCStrategyPlotMulti[] tmp = new TCStrategyPlotMulti[cacheTCStrategyPlotMulti == null ? 1 : cacheTCStrategyPlotMulti.Length + 1];
                if (cacheTCStrategyPlotMulti != null)
                    cacheTCStrategyPlotMulti.CopyTo(tmp, 0);
                tmp[tmp.Length - 1] = indicator;
                cacheTCStrategyPlotMulti = tmp;
                return indicator;
            }
        }