/// <summary>
        /// Implements volume bucketing ala Marcos
        /// </summary>
        /// <returns></returns>
        public ZZVolumeBucketing ZZVolumeBucketing(Data.IDataSeries input, int jmaLen, int volumeBarSize)
        {
            if (cacheZZVolumeBucketing != null)
            {
                for (int idx = 0; idx < cacheZZVolumeBucketing.Length; idx++)
                {
                    if (cacheZZVolumeBucketing[idx].JmaLen == jmaLen && cacheZZVolumeBucketing[idx].VolumeBarSize == volumeBarSize && cacheZZVolumeBucketing[idx].EqualsInput(input))
                    {
                        return(cacheZZVolumeBucketing[idx]);
                    }
                }
            }

            lock (checkZZVolumeBucketing)
            {
                checkZZVolumeBucketing.JmaLen = jmaLen;
                jmaLen = checkZZVolumeBucketing.JmaLen;
                checkZZVolumeBucketing.VolumeBarSize = volumeBarSize;
                volumeBarSize = checkZZVolumeBucketing.VolumeBarSize;

                if (cacheZZVolumeBucketing != null)
                {
                    for (int idx = 0; idx < cacheZZVolumeBucketing.Length; idx++)
                    {
                        if (cacheZZVolumeBucketing[idx].JmaLen == jmaLen && cacheZZVolumeBucketing[idx].VolumeBarSize == volumeBarSize && cacheZZVolumeBucketing[idx].EqualsInput(input))
                        {
                            return(cacheZZVolumeBucketing[idx]);
                        }
                    }
                }

                ZZVolumeBucketing indicator = new ZZVolumeBucketing();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input         = input;
                indicator.JmaLen        = jmaLen;
                indicator.VolumeBarSize = volumeBarSize;
                Indicators.Add(indicator);
                indicator.SetUp();

                ZZVolumeBucketing[] tmp = new ZZVolumeBucketing[cacheZZVolumeBucketing == null ? 1 : cacheZZVolumeBucketing.Length + 1];
                if (cacheZZVolumeBucketing != null)
                {
                    cacheZZVolumeBucketing.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1]    = indicator;
                cacheZZVolumeBucketing = tmp;
                return(indicator);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Enter the description of your new custom indicator here
        /// </summary>
        /// <returns></returns>
        public TrueLevels TrueLevels(Data.IDataSeries input, int levelPrecision, int trendPower)
        {
            if (cacheTrueLevels != null)
            {
                for (int idx = 0; idx < cacheTrueLevels.Length; idx++)
                {
                    if (cacheTrueLevels[idx].LevelPrecision == levelPrecision && cacheTrueLevels[idx].TrendPower == trendPower && cacheTrueLevels[idx].EqualsInput(input))
                    {
                        return(cacheTrueLevels[idx]);
                    }
                }
            }

            lock (checkTrueLevels)
            {
                checkTrueLevels.LevelPrecision = levelPrecision;
                levelPrecision             = checkTrueLevels.LevelPrecision;
                checkTrueLevels.TrendPower = trendPower;
                trendPower = checkTrueLevels.TrendPower;

                if (cacheTrueLevels != null)
                {
                    for (int idx = 0; idx < cacheTrueLevels.Length; idx++)
                    {
                        if (cacheTrueLevels[idx].LevelPrecision == levelPrecision && cacheTrueLevels[idx].TrendPower == trendPower && cacheTrueLevels[idx].EqualsInput(input))
                        {
                            return(cacheTrueLevels[idx]);
                        }
                    }
                }

                TrueLevels indicator = new TrueLevels();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input          = input;
                indicator.LevelPrecision = levelPrecision;
                indicator.TrendPower     = trendPower;
                Indicators.Add(indicator);
                indicator.SetUp();

                TrueLevels[] tmp = new TrueLevels[cacheTrueLevels == null ? 1 : cacheTrueLevels.Length + 1];
                if (cacheTrueLevels != null)
                {
                    cacheTrueLevels.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheTrueLevels     = tmp;
                return(indicator);
            }
        }
        /// <summary>
        /// plot an indicator on one level
        /// </summary>
        /// <returns></returns>
        public plotOneLevel plotOneLevel(Data.IDataSeries input, string alertSound, double level)
        {
            if (cacheplotOneLevel != null)
            {
                for (int idx = 0; idx < cacheplotOneLevel.Length; idx++)
                {
                    if (cacheplotOneLevel[idx].AlertSound == alertSound && Math.Abs(cacheplotOneLevel[idx].Level - level) <= double.Epsilon && cacheplotOneLevel[idx].EqualsInput(input))
                    {
                        return(cacheplotOneLevel[idx]);
                    }
                }
            }

            lock (checkplotOneLevel)
            {
                checkplotOneLevel.AlertSound = alertSound;
                alertSound = checkplotOneLevel.AlertSound;
                checkplotOneLevel.Level = level;
                level = checkplotOneLevel.Level;

                if (cacheplotOneLevel != null)
                {
                    for (int idx = 0; idx < cacheplotOneLevel.Length; idx++)
                    {
                        if (cacheplotOneLevel[idx].AlertSound == alertSound && Math.Abs(cacheplotOneLevel[idx].Level - level) <= double.Epsilon && cacheplotOneLevel[idx].EqualsInput(input))
                        {
                            return(cacheplotOneLevel[idx]);
                        }
                    }
                }

                plotOneLevel indicator = new plotOneLevel();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input      = input;
                indicator.AlertSound = alertSound;
                indicator.Level      = level;
                Indicators.Add(indicator);
                indicator.SetUp();

                plotOneLevel[] tmp = new plotOneLevel[cacheplotOneLevel == null ? 1 : cacheplotOneLevel.Length + 1];
                if (cacheplotOneLevel != null)
                {
                    cacheplotOneLevel.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheplotOneLevel   = tmp;
                return(indicator);
            }
        }
Beispiel #4
0
        /// <summary>
        /// The MAMA (MESA Adaptive Moving Average) was developed by John Ehlers. It adapts to price movement in a new and unique way. The adaptation is based on the Hilbert Transform Discriminator. The adavantage of this method features fast attack average and a slow decay average. The MAMA + the FAMA (Following Adaptive Moving Average) lines only cross at major market reversals.
        /// </summary>
        /// <returns></returns>
        public MAMA MAMA(Data.IDataSeries input, double fastLimit, double slowLimit)
        {
            if (cacheMAMA != null)
            {
                for (int idx = 0; idx < cacheMAMA.Length; idx++)
                {
                    if (Math.Abs(cacheMAMA[idx].FastLimit - fastLimit) <= double.Epsilon && Math.Abs(cacheMAMA[idx].SlowLimit - slowLimit) <= double.Epsilon && cacheMAMA[idx].EqualsInput(input))
                    {
                        return(cacheMAMA[idx]);
                    }
                }
            }

            lock (checkMAMA)
            {
                checkMAMA.FastLimit = fastLimit;
                fastLimit           = checkMAMA.FastLimit;
                checkMAMA.SlowLimit = slowLimit;
                slowLimit           = checkMAMA.SlowLimit;

                if (cacheMAMA != null)
                {
                    for (int idx = 0; idx < cacheMAMA.Length; idx++)
                    {
                        if (Math.Abs(cacheMAMA[idx].FastLimit - fastLimit) <= double.Epsilon && Math.Abs(cacheMAMA[idx].SlowLimit - slowLimit) <= double.Epsilon && cacheMAMA[idx].EqualsInput(input))
                        {
                            return(cacheMAMA[idx]);
                        }
                    }
                }

                MAMA indicator = new MAMA();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input     = input;
                indicator.FastLimit = fastLimit;
                indicator.SlowLimit = slowLimit;
                Indicators.Add(indicator);
                indicator.SetUp();

                MAMA[] tmp = new MAMA[cacheMAMA == null ? 1 : cacheMAMA.Length + 1];
                if (cacheMAMA != null)
                {
                    cacheMAMA.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheMAMA           = tmp;
                return(indicator);
            }
        }
        /// <summary>
        /// Plots the ratio value of the pair.
        /// </summary>
        /// <returns></returns>
        public PairsRatio PairsRatio(Data.IDataSeries input, string firstInstrument, string secondInstrument)
        {
            if (cachePairsRatio != null)
            {
                for (int idx = 0; idx < cachePairsRatio.Length; idx++)
                {
                    if (cachePairsRatio[idx].FirstInstrument == firstInstrument && cachePairsRatio[idx].SecondInstrument == secondInstrument && cachePairsRatio[idx].EqualsInput(input))
                    {
                        return(cachePairsRatio[idx]);
                    }
                }
            }

            lock (checkPairsRatio)
            {
                checkPairsRatio.FirstInstrument = firstInstrument;
                firstInstrument = checkPairsRatio.FirstInstrument;
                checkPairsRatio.SecondInstrument = secondInstrument;
                secondInstrument = checkPairsRatio.SecondInstrument;

                if (cachePairsRatio != null)
                {
                    for (int idx = 0; idx < cachePairsRatio.Length; idx++)
                    {
                        if (cachePairsRatio[idx].FirstInstrument == firstInstrument && cachePairsRatio[idx].SecondInstrument == secondInstrument && cachePairsRatio[idx].EqualsInput(input))
                        {
                            return(cachePairsRatio[idx]);
                        }
                    }
                }

                PairsRatio indicator = new PairsRatio();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input            = input;
                indicator.FirstInstrument  = firstInstrument;
                indicator.SecondInstrument = secondInstrument;
                Indicators.Add(indicator);
                indicator.SetUp();

                PairsRatio[] tmp = new PairsRatio[cachePairsRatio == null ? 1 : cachePairsRatio.Length + 1];
                if (cachePairsRatio != null)
                {
                    cachePairsRatio.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cachePairsRatio     = tmp;
                return(indicator);
            }
        }
Beispiel #6
0
        /// <summary>
        /// GomCD Heikin Ashi
        /// </summary>
        /// <returns></returns>
        public GomCDHA GomCDHA(Data.IDataSeries input, int maxCompBars, int minCompBars)
        {
            if (cacheGomCDHA != null)
            {
                for (int idx = 0; idx < cacheGomCDHA.Length; idx++)
                {
                    if (cacheGomCDHA[idx].MaxCompBars == maxCompBars && cacheGomCDHA[idx].MinCompBars == minCompBars && cacheGomCDHA[idx].EqualsInput(input))
                    {
                        return(cacheGomCDHA[idx]);
                    }
                }
            }

            lock (checkGomCDHA)
            {
                checkGomCDHA.MaxCompBars = maxCompBars;
                maxCompBars = checkGomCDHA.MaxCompBars;
                checkGomCDHA.MinCompBars = minCompBars;
                minCompBars = checkGomCDHA.MinCompBars;

                if (cacheGomCDHA != null)
                {
                    for (int idx = 0; idx < cacheGomCDHA.Length; idx++)
                    {
                        if (cacheGomCDHA[idx].MaxCompBars == maxCompBars && cacheGomCDHA[idx].MinCompBars == minCompBars && cacheGomCDHA[idx].EqualsInput(input))
                        {
                            return(cacheGomCDHA[idx]);
                        }
                    }
                }

                GomCDHA indicator = new GomCDHA();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input       = input;
                indicator.MaxCompBars = maxCompBars;
                indicator.MinCompBars = minCompBars;
                Indicators.Add(indicator);
                indicator.SetUp();

                GomCDHA[] tmp = new GomCDHA[cacheGomCDHA == null ? 1 : cacheGomCDHA.Length + 1];
                if (cacheGomCDHA != null)
                {
                    cacheGomCDHA.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheGomCDHA        = tmp;
                return(indicator);
            }
        }
Beispiel #7
0
        /// <summary>
        /// Displays the tick count of a bar.
        /// </summary>
        /// <returns></returns>
        public TickCounter TickCounter(Data.IDataSeries input, bool countDown, bool showPercent)
        {
            if (cacheTickCounter != null)
            {
                for (int idx = 0; idx < cacheTickCounter.Length; idx++)
                {
                    if (cacheTickCounter[idx].CountDown == countDown && cacheTickCounter[idx].ShowPercent == showPercent && cacheTickCounter[idx].EqualsInput(input))
                    {
                        return(cacheTickCounter[idx]);
                    }
                }
            }

            lock (checkTickCounter)
            {
                checkTickCounter.CountDown = countDown;
                countDown = checkTickCounter.CountDown;
                checkTickCounter.ShowPercent = showPercent;
                showPercent = checkTickCounter.ShowPercent;

                if (cacheTickCounter != null)
                {
                    for (int idx = 0; idx < cacheTickCounter.Length; idx++)
                    {
                        if (cacheTickCounter[idx].CountDown == countDown && cacheTickCounter[idx].ShowPercent == showPercent && cacheTickCounter[idx].EqualsInput(input))
                        {
                            return(cacheTickCounter[idx]);
                        }
                    }
                }

                TickCounter indicator = new TickCounter();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input       = input;
                indicator.CountDown   = countDown;
                indicator.ShowPercent = showPercent;
                Indicators.Add(indicator);
                indicator.SetUp();

                TickCounter[] tmp = new TickCounter[cacheTickCounter == null ? 1 : cacheTickCounter.Length + 1];
                if (cacheTickCounter != null)
                {
                    cacheTickCounter.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheTickCounter    = tmp;
                return(indicator);
            }
        }
Beispiel #8
0
        /// <summary>
        /// Bollinger Bands are plotted at standard deviation levels above and below a moving average. Since standard deviation is a measure of volatility, the bands are self-adjusting: widening during volatile markets and contracting during calmer periods.
        /// </summary>
        /// <returns></returns>
        public AhrensBB AhrensBB(Data.IDataSeries input, double numStdDev, int period)
        {
            if (cacheAhrensBB != null)
            {
                for (int idx = 0; idx < cacheAhrensBB.Length; idx++)
                {
                    if (Math.Abs(cacheAhrensBB[idx].NumStdDev - numStdDev) <= double.Epsilon && cacheAhrensBB[idx].Period == period && cacheAhrensBB[idx].EqualsInput(input))
                    {
                        return(cacheAhrensBB[idx]);
                    }
                }
            }

            lock (checkAhrensBB)
            {
                checkAhrensBB.NumStdDev = numStdDev;
                numStdDev            = checkAhrensBB.NumStdDev;
                checkAhrensBB.Period = period;
                period = checkAhrensBB.Period;

                if (cacheAhrensBB != null)
                {
                    for (int idx = 0; idx < cacheAhrensBB.Length; idx++)
                    {
                        if (Math.Abs(cacheAhrensBB[idx].NumStdDev - numStdDev) <= double.Epsilon && cacheAhrensBB[idx].Period == period && cacheAhrensBB[idx].EqualsInput(input))
                        {
                            return(cacheAhrensBB[idx]);
                        }
                    }
                }

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

                AhrensBB[] tmp = new AhrensBB[cacheAhrensBB == null ? 1 : cacheAhrensBB.Length + 1];
                if (cacheAhrensBB != null)
                {
                    cacheAhrensBB.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheAhrensBB       = tmp;
                return(indicator);
            }
        }
Beispiel #9
0
        /// <summary>
        /// Variable moving average
        /// </summary>
        /// <returns></returns>
        public MAV MAV(Data.IDataSeries input, int mAPeriod, int typeInt)
        {
            if (cacheMAV != null)
            {
                for (int idx = 0; idx < cacheMAV.Length; idx++)
                {
                    if (cacheMAV[idx].MAPeriod == mAPeriod && cacheMAV[idx].TypeInt == typeInt && cacheMAV[idx].EqualsInput(input))
                    {
                        return(cacheMAV[idx]);
                    }
                }
            }

            lock (checkMAV)
            {
                checkMAV.MAPeriod = mAPeriod;
                mAPeriod          = checkMAV.MAPeriod;
                checkMAV.TypeInt  = typeInt;
                typeInt           = checkMAV.TypeInt;

                if (cacheMAV != null)
                {
                    for (int idx = 0; idx < cacheMAV.Length; idx++)
                    {
                        if (cacheMAV[idx].MAPeriod == mAPeriod && cacheMAV[idx].TypeInt == typeInt && cacheMAV[idx].EqualsInput(input))
                        {
                            return(cacheMAV[idx]);
                        }
                    }
                }

                MAV indicator = new MAV();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input    = input;
                indicator.MAPeriod = mAPeriod;
                indicator.TypeInt  = typeInt;
                Indicators.Add(indicator);
                indicator.SetUp();

                MAV[] tmp = new MAV[cacheMAV == null ? 1 : cacheMAV.Length + 1];
                if (cacheMAV != null)
                {
                    cacheMAV.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheMAV            = tmp;
                return(indicator);
            }
        }
Beispiel #10
0
        /// <summary>
        /// the Holt trend-adjusted EMA [email protected]
        /// </summary>
        /// <returns></returns>
        public HoltEMA HoltEMA(Data.IDataSeries input, double alpha, double gamma)
        {
            if (cacheHoltEMA != null)
            {
                for (int idx = 0; idx < cacheHoltEMA.Length; idx++)
                {
                    if (Math.Abs(cacheHoltEMA[idx].Alpha - alpha) <= double.Epsilon && Math.Abs(cacheHoltEMA[idx].Gamma - gamma) <= double.Epsilon && cacheHoltEMA[idx].EqualsInput(input))
                    {
                        return(cacheHoltEMA[idx]);
                    }
                }
            }

            lock (checkHoltEMA)
            {
                checkHoltEMA.Alpha = alpha;
                alpha = checkHoltEMA.Alpha;
                checkHoltEMA.Gamma = gamma;
                gamma = checkHoltEMA.Gamma;

                if (cacheHoltEMA != null)
                {
                    for (int idx = 0; idx < cacheHoltEMA.Length; idx++)
                    {
                        if (Math.Abs(cacheHoltEMA[idx].Alpha - alpha) <= double.Epsilon && Math.Abs(cacheHoltEMA[idx].Gamma - gamma) <= double.Epsilon && cacheHoltEMA[idx].EqualsInput(input))
                        {
                            return(cacheHoltEMA[idx]);
                        }
                    }
                }

                HoltEMA indicator = new HoltEMA();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                indicator.Alpha = alpha;
                indicator.Gamma = gamma;
                Indicators.Add(indicator);
                indicator.SetUp();

                HoltEMA[] tmp = new HoltEMA[cacheHoltEMA == null ? 1 : cacheHoltEMA.Length + 1];
                if (cacheHoltEMA != null)
                {
                    cacheHoltEMA.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheHoltEMA        = tmp;
                return(indicator);
            }
        }
        /// <summary>
        /// JMA Double Stochastic
        /// </summary>
        /// <returns></returns>
        public Jurik_JMA_DoubleStoch Jurik_JMA_DoubleStoch(Data.IDataSeries input, double jma_len, int stoch_len)
        {
            if (cacheJurik_JMA_DoubleStoch != null)
            {
                for (int idx = 0; idx < cacheJurik_JMA_DoubleStoch.Length; idx++)
                {
                    if (Math.Abs(cacheJurik_JMA_DoubleStoch[idx].Jma_len - jma_len) <= double.Epsilon && cacheJurik_JMA_DoubleStoch[idx].Stoch_len == stoch_len && cacheJurik_JMA_DoubleStoch[idx].EqualsInput(input))
                    {
                        return(cacheJurik_JMA_DoubleStoch[idx]);
                    }
                }
            }

            lock (checkJurik_JMA_DoubleStoch)
            {
                checkJurik_JMA_DoubleStoch.Jma_len = jma_len;
                jma_len = checkJurik_JMA_DoubleStoch.Jma_len;
                checkJurik_JMA_DoubleStoch.Stoch_len = stoch_len;
                stoch_len = checkJurik_JMA_DoubleStoch.Stoch_len;

                if (cacheJurik_JMA_DoubleStoch != null)
                {
                    for (int idx = 0; idx < cacheJurik_JMA_DoubleStoch.Length; idx++)
                    {
                        if (Math.Abs(cacheJurik_JMA_DoubleStoch[idx].Jma_len - jma_len) <= double.Epsilon && cacheJurik_JMA_DoubleStoch[idx].Stoch_len == stoch_len && cacheJurik_JMA_DoubleStoch[idx].EqualsInput(input))
                        {
                            return(cacheJurik_JMA_DoubleStoch[idx]);
                        }
                    }
                }

                Jurik_JMA_DoubleStoch indicator = new Jurik_JMA_DoubleStoch();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input     = input;
                indicator.Jma_len   = jma_len;
                indicator.Stoch_len = stoch_len;
                Indicators.Add(indicator);
                indicator.SetUp();

                Jurik_JMA_DoubleStoch[] tmp = new Jurik_JMA_DoubleStoch[cacheJurik_JMA_DoubleStoch == null ? 1 : cacheJurik_JMA_DoubleStoch.Length + 1];
                if (cacheJurik_JMA_DoubleStoch != null)
                {
                    cacheJurik_JMA_DoubleStoch.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1]        = indicator;
                cacheJurik_JMA_DoubleStoch = tmp;
                return(indicator);
            }
        }
        /// <summary>
        /// Trigger Lines.
        /// </summary>
        /// <returns></returns>
        public TriggerLines TriggerLines(Data.IDataSeries input, int period, int trigAvg)
        {
            if (cacheTriggerLines != null)
            {
                for (int idx = 0; idx < cacheTriggerLines.Length; idx++)
                {
                    if (cacheTriggerLines[idx].Period == period && cacheTriggerLines[idx].TrigAvg == trigAvg && cacheTriggerLines[idx].EqualsInput(input))
                    {
                        return(cacheTriggerLines[idx]);
                    }
                }
            }

            lock (checkTriggerLines)
            {
                checkTriggerLines.Period = period;
                period = checkTriggerLines.Period;
                checkTriggerLines.TrigAvg = trigAvg;
                trigAvg = checkTriggerLines.TrigAvg;

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

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

                TriggerLines[] tmp = new TriggerLines[cacheTriggerLines == null ? 1 : cacheTriggerLines.Length + 1];
                if (cacheTriggerLines != null)
                {
                    cacheTriggerLines.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheTriggerLines   = tmp;
                return(indicator);
            }
        }
        /// <summary>
        /// The indicator regroups single bars to display them as Multi Period Boxes
        /// </summary>
        /// <returns></returns>
        public anaMultiPeriodBoxes anaMultiPeriodBoxes(Data.IDataSeries input, int opacity, int period)
        {
            if (cacheanaMultiPeriodBoxes != null)
            {
                for (int idx = 0; idx < cacheanaMultiPeriodBoxes.Length; idx++)
                {
                    if (cacheanaMultiPeriodBoxes[idx].Opacity == opacity && cacheanaMultiPeriodBoxes[idx].Period == period && cacheanaMultiPeriodBoxes[idx].EqualsInput(input))
                    {
                        return(cacheanaMultiPeriodBoxes[idx]);
                    }
                }
            }

            lock (checkanaMultiPeriodBoxes)
            {
                checkanaMultiPeriodBoxes.Opacity = opacity;
                opacity = checkanaMultiPeriodBoxes.Opacity;
                checkanaMultiPeriodBoxes.Period = period;
                period = checkanaMultiPeriodBoxes.Period;

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

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

                anaMultiPeriodBoxes[] tmp = new anaMultiPeriodBoxes[cacheanaMultiPeriodBoxes == null ? 1 : cacheanaMultiPeriodBoxes.Length + 1];
                if (cacheanaMultiPeriodBoxes != null)
                {
                    cacheanaMultiPeriodBoxes.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1]      = indicator;
                cacheanaMultiPeriodBoxes = tmp;
                return(indicator);
            }
        }
Beispiel #14
0
        /// <summary>
        /// VPIN indicator
        /// </summary>
        /// <returns></returns>
        public ZZVPINcdf ZZVPINcdf(Data.IDataSeries input, int sampleSize, int volBucketSize)
        {
            if (cacheZZVPINcdf != null)
            {
                for (int idx = 0; idx < cacheZZVPINcdf.Length; idx++)
                {
                    if (cacheZZVPINcdf[idx].SampleSize == sampleSize && cacheZZVPINcdf[idx].VolBucketSize == volBucketSize && cacheZZVPINcdf[idx].EqualsInput(input))
                    {
                        return(cacheZZVPINcdf[idx]);
                    }
                }
            }

            lock (checkZZVPINcdf)
            {
                checkZZVPINcdf.SampleSize = sampleSize;
                sampleSize = checkZZVPINcdf.SampleSize;
                checkZZVPINcdf.VolBucketSize = volBucketSize;
                volBucketSize = checkZZVPINcdf.VolBucketSize;

                if (cacheZZVPINcdf != null)
                {
                    for (int idx = 0; idx < cacheZZVPINcdf.Length; idx++)
                    {
                        if (cacheZZVPINcdf[idx].SampleSize == sampleSize && cacheZZVPINcdf[idx].VolBucketSize == volBucketSize && cacheZZVPINcdf[idx].EqualsInput(input))
                        {
                            return(cacheZZVPINcdf[idx]);
                        }
                    }
                }

                ZZVPINcdf indicator = new ZZVPINcdf();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input         = input;
                indicator.SampleSize    = sampleSize;
                indicator.VolBucketSize = volBucketSize;
                Indicators.Add(indicator);
                indicator.SetUp();

                ZZVPINcdf[] tmp = new ZZVPINcdf[cacheZZVPINcdf == null ? 1 : cacheZZVPINcdf.Length + 1];
                if (cacheZZVPINcdf != null)
                {
                    cacheZZVPINcdf.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheZZVPINcdf      = tmp;
                return(indicator);
            }
        }
        /// <summary>
        /// Quantifying slope od EMA
        /// </summary>
        /// <returns></returns>
        public ZZSlopeQuant ZZSlopeQuant(Data.IDataSeries input, int eMAPeriod, int lookbackBars)
        {
            if (cacheZZSlopeQuant != null)
            {
                for (int idx = 0; idx < cacheZZSlopeQuant.Length; idx++)
                {
                    if (cacheZZSlopeQuant[idx].EMAPeriod == eMAPeriod && cacheZZSlopeQuant[idx].LookbackBars == lookbackBars && cacheZZSlopeQuant[idx].EqualsInput(input))
                    {
                        return(cacheZZSlopeQuant[idx]);
                    }
                }
            }

            lock (checkZZSlopeQuant)
            {
                checkZZSlopeQuant.EMAPeriod = eMAPeriod;
                eMAPeriod = checkZZSlopeQuant.EMAPeriod;
                checkZZSlopeQuant.LookbackBars = lookbackBars;
                lookbackBars = checkZZSlopeQuant.LookbackBars;

                if (cacheZZSlopeQuant != null)
                {
                    for (int idx = 0; idx < cacheZZSlopeQuant.Length; idx++)
                    {
                        if (cacheZZSlopeQuant[idx].EMAPeriod == eMAPeriod && cacheZZSlopeQuant[idx].LookbackBars == lookbackBars && cacheZZSlopeQuant[idx].EqualsInput(input))
                        {
                            return(cacheZZSlopeQuant[idx]);
                        }
                    }
                }

                ZZSlopeQuant indicator = new ZZSlopeQuant();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input        = input;
                indicator.EMAPeriod    = eMAPeriod;
                indicator.LookbackBars = lookbackBars;
                Indicators.Add(indicator);
                indicator.SetUp();

                ZZSlopeQuant[] tmp = new ZZSlopeQuant[cacheZZSlopeQuant == null ? 1 : cacheZZSlopeQuant.Length + 1];
                if (cacheZZSlopeQuant != null)
                {
                    cacheZZSlopeQuant.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheZZSlopeQuant   = tmp;
                return(indicator);
            }
        }
Beispiel #16
0
        /// <summary>
        /// Enter the description of your new custom indicator here
        /// </summary>
        /// <returns></returns>
        public EMAofATR EMAofATR(Data.IDataSeries input, double multiplier, int period)
        {
            if (cacheEMAofATR != null)
            {
                for (int idx = 0; idx < cacheEMAofATR.Length; idx++)
                {
                    if (Math.Abs(cacheEMAofATR[idx].Multiplier - multiplier) <= double.Epsilon && cacheEMAofATR[idx].Period == period && cacheEMAofATR[idx].EqualsInput(input))
                    {
                        return(cacheEMAofATR[idx]);
                    }
                }
            }

            lock (checkEMAofATR)
            {
                checkEMAofATR.Multiplier = multiplier;
                multiplier           = checkEMAofATR.Multiplier;
                checkEMAofATR.Period = period;
                period = checkEMAofATR.Period;

                if (cacheEMAofATR != null)
                {
                    for (int idx = 0; idx < cacheEMAofATR.Length; idx++)
                    {
                        if (Math.Abs(cacheEMAofATR[idx].Multiplier - multiplier) <= double.Epsilon && cacheEMAofATR[idx].Period == period && cacheEMAofATR[idx].EqualsInput(input))
                        {
                            return(cacheEMAofATR[idx]);
                        }
                    }
                }

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

                EMAofATR[] tmp = new EMAofATR[cacheEMAofATR == null ? 1 : cacheEMAofATR.Length + 1];
                if (cacheEMAofATR != null)
                {
                    cacheEMAofATR.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheEMAofATR       = tmp;
                return(indicator);
            }
        }
Beispiel #17
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public DStochZeroLag DStochZeroLag(Data.IDataSeries input, int dSTlen, int priceactionFilter)
        {
            if (cacheDStochZeroLag != null)
            {
                for (int idx = 0; idx < cacheDStochZeroLag.Length; idx++)
                {
                    if (cacheDStochZeroLag[idx].DSTlen == dSTlen && cacheDStochZeroLag[idx].PriceactionFilter == priceactionFilter && cacheDStochZeroLag[idx].EqualsInput(input))
                    {
                        return(cacheDStochZeroLag[idx]);
                    }
                }
            }

            lock (checkDStochZeroLag)
            {
                checkDStochZeroLag.DSTlen = dSTlen;
                dSTlen = checkDStochZeroLag.DSTlen;
                checkDStochZeroLag.PriceactionFilter = priceactionFilter;
                priceactionFilter = checkDStochZeroLag.PriceactionFilter;

                if (cacheDStochZeroLag != null)
                {
                    for (int idx = 0; idx < cacheDStochZeroLag.Length; idx++)
                    {
                        if (cacheDStochZeroLag[idx].DSTlen == dSTlen && cacheDStochZeroLag[idx].PriceactionFilter == priceactionFilter && cacheDStochZeroLag[idx].EqualsInput(input))
                        {
                            return(cacheDStochZeroLag[idx]);
                        }
                    }
                }

                DStochZeroLag indicator = new DStochZeroLag();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input             = input;
                indicator.DSTlen            = dSTlen;
                indicator.PriceactionFilter = priceactionFilter;
                Indicators.Add(indicator);
                indicator.SetUp();

                DStochZeroLag[] tmp = new DStochZeroLag[cacheDStochZeroLag == null ? 1 : cacheDStochZeroLag.Length + 1];
                if (cacheDStochZeroLag != null)
                {
                    cacheDStochZeroLag.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheDStochZeroLag  = tmp;
                return(indicator);
            }
        }
        /// <summary>
        /// laguerre rsi
        /// </summary>
        /// <returns></returns>
        public Z20101212LaguerreRSI Z20101212LaguerreRSI(Data.IDataSeries input, double gamma, int length)
        {
            if (cacheZ20101212LaguerreRSI != null)
            {
                for (int idx = 0; idx < cacheZ20101212LaguerreRSI.Length; idx++)
                {
                    if (Math.Abs(cacheZ20101212LaguerreRSI[idx].Gamma - gamma) <= double.Epsilon && cacheZ20101212LaguerreRSI[idx].Length == length && cacheZ20101212LaguerreRSI[idx].EqualsInput(input))
                    {
                        return(cacheZ20101212LaguerreRSI[idx]);
                    }
                }
            }

            lock (checkZ20101212LaguerreRSI)
            {
                checkZ20101212LaguerreRSI.Gamma = gamma;
                gamma = checkZ20101212LaguerreRSI.Gamma;
                checkZ20101212LaguerreRSI.Length = length;
                length = checkZ20101212LaguerreRSI.Length;

                if (cacheZ20101212LaguerreRSI != null)
                {
                    for (int idx = 0; idx < cacheZ20101212LaguerreRSI.Length; idx++)
                    {
                        if (Math.Abs(cacheZ20101212LaguerreRSI[idx].Gamma - gamma) <= double.Epsilon && cacheZ20101212LaguerreRSI[idx].Length == length && cacheZ20101212LaguerreRSI[idx].EqualsInput(input))
                        {
                            return(cacheZ20101212LaguerreRSI[idx]);
                        }
                    }
                }

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

                Z20101212LaguerreRSI[] tmp = new Z20101212LaguerreRSI[cacheZ20101212LaguerreRSI == null ? 1 : cacheZ20101212LaguerreRSI.Length + 1];
                if (cacheZ20101212LaguerreRSI != null)
                {
                    cacheZ20101212LaguerreRSI.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1]       = indicator;
                cacheZ20101212LaguerreRSI = tmp;
                return(indicator);
            }
        }
Beispiel #19
0
        /// <summary>
        /// The TSF (Time Series Forecast) calculates probable future values for the price by fitting a linear regression line over a given number of price bars and following that line forward into the future. A linear regression line is a straight line which is as close to all of the given price points as possible. Also see the Linear Regression indicator.
        /// </summary>
        /// <returns></returns>
        public TSF TSF(Data.IDataSeries input, int forecast, int period)
        {
            if (cacheTSF != null)
            {
                for (int idx = 0; idx < cacheTSF.Length; idx++)
                {
                    if (cacheTSF[idx].Forecast == forecast && cacheTSF[idx].Period == period && cacheTSF[idx].EqualsInput(input))
                    {
                        return(cacheTSF[idx]);
                    }
                }
            }

            lock (checkTSF)
            {
                checkTSF.Forecast = forecast;
                forecast          = checkTSF.Forecast;
                checkTSF.Period   = period;
                period            = checkTSF.Period;

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

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

                TSF[] tmp = new TSF[cacheTSF == null ? 1 : cacheTSF.Length + 1];
                if (cacheTSF != null)
                {
                    cacheTSF.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheTSF            = tmp;
                return(indicator);
            }
        }
Beispiel #20
0
        /// <summary>
        /// The SMA (Simple Moving Average) is an indicator that shows the average value of a security's price over a period of time.
        /// </summary>
        /// <returns></returns>
        public SMAAqueGen SMAAqueGen(Data.IDataSeries input, int dayOfSMAValot, int sMAPeriod)
        {
            if (cacheSMAAqueGen != null)
            {
                for (int idx = 0; idx < cacheSMAAqueGen.Length; idx++)
                {
                    if (cacheSMAAqueGen[idx].DayOfSMAValot == dayOfSMAValot && cacheSMAAqueGen[idx].SMAPeriod == sMAPeriod && cacheSMAAqueGen[idx].EqualsInput(input))
                    {
                        return(cacheSMAAqueGen[idx]);
                    }
                }
            }

            lock (checkSMAAqueGen)
            {
                checkSMAAqueGen.DayOfSMAValot = dayOfSMAValot;
                dayOfSMAValot             = checkSMAAqueGen.DayOfSMAValot;
                checkSMAAqueGen.SMAPeriod = sMAPeriod;
                sMAPeriod = checkSMAAqueGen.SMAPeriod;

                if (cacheSMAAqueGen != null)
                {
                    for (int idx = 0; idx < cacheSMAAqueGen.Length; idx++)
                    {
                        if (cacheSMAAqueGen[idx].DayOfSMAValot == dayOfSMAValot && cacheSMAAqueGen[idx].SMAPeriod == sMAPeriod && cacheSMAAqueGen[idx].EqualsInput(input))
                        {
                            return(cacheSMAAqueGen[idx]);
                        }
                    }
                }

                SMAAqueGen indicator = new SMAAqueGen();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input         = input;
                indicator.DayOfSMAValot = dayOfSMAValot;
                indicator.SMAPeriod     = sMAPeriod;
                Indicators.Add(indicator);
                indicator.SetUp();

                SMAAqueGen[] tmp = new SMAAqueGen[cacheSMAAqueGen == null ? 1 : cacheSMAAqueGen.Length + 1];
                if (cacheSMAAqueGen != null)
                {
                    cacheSMAAqueGen.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheSMAAqueGen     = tmp;
                return(indicator);
            }
        }
Beispiel #21
0
        /// <summary>
        /// Guppy Stuff
        /// </summary>
        /// <returns></returns>
        public zRainbowEMA zRainbowEMA(Data.IDataSeries input, bool startsOn, bool useThreeBands)
        {
            if (cachezRainbowEMA != null)
            {
                for (int idx = 0; idx < cachezRainbowEMA.Length; idx++)
                {
                    if (cachezRainbowEMA[idx].StartsOn == startsOn && cachezRainbowEMA[idx].UseThreeBands == useThreeBands && cachezRainbowEMA[idx].EqualsInput(input))
                    {
                        return(cachezRainbowEMA[idx]);
                    }
                }
            }

            lock (checkzRainbowEMA)
            {
                checkzRainbowEMA.StartsOn = startsOn;
                startsOn = checkzRainbowEMA.StartsOn;
                checkzRainbowEMA.UseThreeBands = useThreeBands;
                useThreeBands = checkzRainbowEMA.UseThreeBands;

                if (cachezRainbowEMA != null)
                {
                    for (int idx = 0; idx < cachezRainbowEMA.Length; idx++)
                    {
                        if (cachezRainbowEMA[idx].StartsOn == startsOn && cachezRainbowEMA[idx].UseThreeBands == useThreeBands && cachezRainbowEMA[idx].EqualsInput(input))
                        {
                            return(cachezRainbowEMA[idx]);
                        }
                    }
                }

                zRainbowEMA indicator = new zRainbowEMA();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input         = input;
                indicator.StartsOn      = startsOn;
                indicator.UseThreeBands = useThreeBands;
                Indicators.Add(indicator);
                indicator.SetUp();

                zRainbowEMA[] tmp = new zRainbowEMA[cachezRainbowEMA == null ? 1 : cachezRainbowEMA.Length + 1];
                if (cachezRainbowEMA != null)
                {
                    cachezRainbowEMA.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cachezRainbowEMA    = tmp;
                return(indicator);
            }
        }
Beispiel #22
0
        /// <summary>
        /// The PFE (Polarized Fractal Efficiency) is an indicator that uses fractal geometry to determine how efficiently the price is moving.
        /// </summary>
        /// <returns></returns>
        public PFE PFE(Data.IDataSeries input, int period, int smooth)
        {
            if (cachePFE != null)
            {
                for (int idx = 0; idx < cachePFE.Length; idx++)
                {
                    if (cachePFE[idx].Period == period && cachePFE[idx].Smooth == smooth && cachePFE[idx].EqualsInput(input))
                    {
                        return(cachePFE[idx]);
                    }
                }
            }

            lock (checkPFE)
            {
                checkPFE.Period = period;
                period          = checkPFE.Period;
                checkPFE.Smooth = smooth;
                smooth          = checkPFE.Smooth;

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

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

                PFE[] tmp = new PFE[cachePFE == null ? 1 : cachePFE.Length + 1];
                if (cachePFE != null)
                {
                    cachePFE.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cachePFE            = tmp;
                return(indicator);
            }
        }
Beispiel #23
0
        private void CreateMarkingZones(SolidColorBrush ZoneBrush, Pen ZonePen, VisualShape ManipulatedShape)
        {
            foreach (var MarkingZone in ManipulatedShape.CurrentMarkingZones)
            {
                var IconZone = (new GeometryDrawing(ZoneBrush, ZonePen, new RectangleGeometry(MarkingZone.Item2))).RenderToDrawingVisual();
                IconZone.Opacity = FrmOpacityEdit;

                Indicators.Add(IconZone);
                FrmMarkingZones.Add(IconZone, MarkingZone.Item1);
            }
        }
Beispiel #24
0
        /// <summary>
        /// Subtract the Dexp from the Momo and see what's shakin
        /// </summary>
        /// <returns></returns>
        public zDexpMomoSub zDexpMomoSub(Data.IDataSeries input, double alpha, int momo)
        {
            if (cachezDexpMomoSub != null)
            {
                for (int idx = 0; idx < cachezDexpMomoSub.Length; idx++)
                {
                    if (Math.Abs(cachezDexpMomoSub[idx].Alpha - alpha) <= double.Epsilon && cachezDexpMomoSub[idx].Momo == momo && cachezDexpMomoSub[idx].EqualsInput(input))
                    {
                        return(cachezDexpMomoSub[idx]);
                    }
                }
            }

            lock (checkzDexpMomoSub)
            {
                checkzDexpMomoSub.Alpha = alpha;
                alpha = checkzDexpMomoSub.Alpha;
                checkzDexpMomoSub.Momo = momo;
                momo = checkzDexpMomoSub.Momo;

                if (cachezDexpMomoSub != null)
                {
                    for (int idx = 0; idx < cachezDexpMomoSub.Length; idx++)
                    {
                        if (Math.Abs(cachezDexpMomoSub[idx].Alpha - alpha) <= double.Epsilon && cachezDexpMomoSub[idx].Momo == momo && cachezDexpMomoSub[idx].EqualsInput(input))
                        {
                            return(cachezDexpMomoSub[idx]);
                        }
                    }
                }

                zDexpMomoSub indicator = new zDexpMomoSub();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                indicator.Alpha = alpha;
                indicator.Momo  = momo;
                Indicators.Add(indicator);
                indicator.SetUp();

                zDexpMomoSub[] tmp = new zDexpMomoSub[cachezDexpMomoSub == null ? 1 : cachezDexpMomoSub.Length + 1];
                if (cachezDexpMomoSub != null)
                {
                    cachezDexpMomoSub.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cachezDexpMomoSub   = tmp;
                return(indicator);
            }
        }
Beispiel #25
0
        /// <summary>
        /// my rsi
        /// </summary>
        /// <returns></returns>
        public zRSI zRSI(Data.IDataSeries input, double alphaTLine, double alphaUD)
        {
            if (cachezRSI != null)
            {
                for (int idx = 0; idx < cachezRSI.Length; idx++)
                {
                    if (Math.Abs(cachezRSI[idx].AlphaTLine - alphaTLine) <= double.Epsilon && Math.Abs(cachezRSI[idx].AlphaUD - alphaUD) <= double.Epsilon && cachezRSI[idx].EqualsInput(input))
                    {
                        return(cachezRSI[idx]);
                    }
                }
            }

            lock (checkzRSI)
            {
                checkzRSI.AlphaTLine = alphaTLine;
                alphaTLine           = checkzRSI.AlphaTLine;
                checkzRSI.AlphaUD    = alphaUD;
                alphaUD = checkzRSI.AlphaUD;

                if (cachezRSI != null)
                {
                    for (int idx = 0; idx < cachezRSI.Length; idx++)
                    {
                        if (Math.Abs(cachezRSI[idx].AlphaTLine - alphaTLine) <= double.Epsilon && Math.Abs(cachezRSI[idx].AlphaUD - alphaUD) <= double.Epsilon && cachezRSI[idx].EqualsInput(input))
                        {
                            return(cachezRSI[idx]);
                        }
                    }
                }

                zRSI indicator = new zRSI();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input      = input;
                indicator.AlphaTLine = alphaTLine;
                indicator.AlphaUD    = alphaUD;
                Indicators.Add(indicator);
                indicator.SetUp();

                zRSI[] tmp = new zRSI[cachezRSI == null ? 1 : cachezRSI.Length + 1];
                if (cachezRSI != null)
                {
                    cachezRSI.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cachezRSI           = tmp;
                return(indicator);
            }
        }
Beispiel #26
0
        /// <summary>
        /// Enter the description of your new custom indicator here
        /// </summary>
        /// <returns></returns>
        public TrendBreaks TrendBreaks(Data.IDataSeries input, int maxLookBack, int minLookBack)
        {
            if (cacheTrendBreaks != null)
            {
                for (int idx = 0; idx < cacheTrendBreaks.Length; idx++)
                {
                    if (cacheTrendBreaks[idx].MaxLookBack == maxLookBack && cacheTrendBreaks[idx].MinLookBack == minLookBack && cacheTrendBreaks[idx].EqualsInput(input))
                    {
                        return(cacheTrendBreaks[idx]);
                    }
                }
            }

            lock (checkTrendBreaks)
            {
                checkTrendBreaks.MaxLookBack = maxLookBack;
                maxLookBack = checkTrendBreaks.MaxLookBack;
                checkTrendBreaks.MinLookBack = minLookBack;
                minLookBack = checkTrendBreaks.MinLookBack;

                if (cacheTrendBreaks != null)
                {
                    for (int idx = 0; idx < cacheTrendBreaks.Length; idx++)
                    {
                        if (cacheTrendBreaks[idx].MaxLookBack == maxLookBack && cacheTrendBreaks[idx].MinLookBack == minLookBack && cacheTrendBreaks[idx].EqualsInput(input))
                        {
                            return(cacheTrendBreaks[idx]);
                        }
                    }
                }

                TrendBreaks indicator = new TrendBreaks();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input       = input;
                indicator.MaxLookBack = maxLookBack;
                indicator.MinLookBack = minLookBack;
                Indicators.Add(indicator);
                indicator.SetUp();

                TrendBreaks[] tmp = new TrendBreaks[cacheTrendBreaks == null ? 1 : cacheTrendBreaks.Length + 1];
                if (cacheTrendBreaks != null)
                {
                    cacheTrendBreaks.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheTrendBreaks    = tmp;
                return(indicator);
            }
        }
Beispiel #27
0
        /// <summary>
        /// Shows how perdictable the instrument trend
        /// </summary>
        /// <returns></returns>
        public TrendPredictability TrendPredictability(Data.IDataSeries input, int maxConsecutiveBars, int period)
        {
            if (cacheTrendPredictability != null)
            {
                for (int idx = 0; idx < cacheTrendPredictability.Length; idx++)
                {
                    if (cacheTrendPredictability[idx].MaxConsecutiveBars == maxConsecutiveBars && cacheTrendPredictability[idx].Period == period && cacheTrendPredictability[idx].EqualsInput(input))
                    {
                        return(cacheTrendPredictability[idx]);
                    }
                }
            }

            lock (checkTrendPredictability)
            {
                checkTrendPredictability.MaxConsecutiveBars = maxConsecutiveBars;
                maxConsecutiveBars = checkTrendPredictability.MaxConsecutiveBars;
                checkTrendPredictability.Period = period;
                period = checkTrendPredictability.Period;

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

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

                TrendPredictability[] tmp = new TrendPredictability[cacheTrendPredictability == null ? 1 : cacheTrendPredictability.Length + 1];
                if (cacheTrendPredictability != null)
                {
                    cacheTrendPredictability.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1]      = indicator;
                cacheTrendPredictability = tmp;
                return(indicator);
            }
        }
Beispiel #28
0
        /// <summary>
        /// Low Lag Moving Average
        /// </summary>
        /// <returns></returns>
        public LLMA LLMA(Data.IDataSeries input, int length, double phase)
        {
            if (cacheLLMA != null)
            {
                for (int idx = 0; idx < cacheLLMA.Length; idx++)
                {
                    if (cacheLLMA[idx].Length == length && Math.Abs(cacheLLMA[idx].Phase - phase) <= double.Epsilon && cacheLLMA[idx].EqualsInput(input))
                    {
                        return(cacheLLMA[idx]);
                    }
                }
            }

            lock (checkLLMA)
            {
                checkLLMA.Length = length;
                length           = checkLLMA.Length;
                checkLLMA.Phase  = phase;
                phase            = checkLLMA.Phase;

                if (cacheLLMA != null)
                {
                    for (int idx = 0; idx < cacheLLMA.Length; idx++)
                    {
                        if (cacheLLMA[idx].Length == length && Math.Abs(cacheLLMA[idx].Phase - phase) <= double.Epsilon && cacheLLMA[idx].EqualsInput(input))
                        {
                            return(cacheLLMA[idx]);
                        }
                    }
                }

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

                LLMA[] tmp = new LLMA[cacheLLMA == null ? 1 : cacheLLMA.Length + 1];
                if (cacheLLMA != null)
                {
                    cacheLLMA.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheLLMA           = tmp;
                return(indicator);
            }
        }
Beispiel #29
0
        /// <summary>
        /// A signal on ACD return 1, if signal true
        /// </summary>
        /// <returns></returns>
        public ZZACD00Asignal ZZACD00Asignal(Data.IDataSeries input, int numBarAsignal, int oRNumBars)
        {
            if (cacheZZACD00Asignal != null)
            {
                for (int idx = 0; idx < cacheZZACD00Asignal.Length; idx++)
                {
                    if (cacheZZACD00Asignal[idx].NumBarAsignal == numBarAsignal && cacheZZACD00Asignal[idx].ORNumBars == oRNumBars && cacheZZACD00Asignal[idx].EqualsInput(input))
                    {
                        return(cacheZZACD00Asignal[idx]);
                    }
                }
            }

            lock (checkZZACD00Asignal)
            {
                checkZZACD00Asignal.NumBarAsignal = numBarAsignal;
                numBarAsignal = checkZZACD00Asignal.NumBarAsignal;
                checkZZACD00Asignal.ORNumBars = oRNumBars;
                oRNumBars = checkZZACD00Asignal.ORNumBars;

                if (cacheZZACD00Asignal != null)
                {
                    for (int idx = 0; idx < cacheZZACD00Asignal.Length; idx++)
                    {
                        if (cacheZZACD00Asignal[idx].NumBarAsignal == numBarAsignal && cacheZZACD00Asignal[idx].ORNumBars == oRNumBars && cacheZZACD00Asignal[idx].EqualsInput(input))
                        {
                            return(cacheZZACD00Asignal[idx]);
                        }
                    }
                }

                ZZACD00Asignal indicator = new ZZACD00Asignal();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input         = input;
                indicator.NumBarAsignal = numBarAsignal;
                indicator.ORNumBars     = oRNumBars;
                Indicators.Add(indicator);
                indicator.SetUp();

                ZZACD00Asignal[] tmp = new ZZACD00Asignal[cacheZZACD00Asignal == null ? 1 : cacheZZACD00Asignal.Length + 1];
                if (cacheZZACD00Asignal != null)
                {
                    cacheZZACD00Asignal.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheZZACD00Asignal = tmp;
                return(indicator);
            }
        }
Beispiel #30
0
        /// <summary>
        /// Alert on any pullback met requirment of AS
        /// </summary>
        /// <returns></returns>
        public AlertPullbacks AlertPullbacks(Data.IDataSeries input, bool useMACD, bool useMomentum)
        {
            if (cacheAlertPullbacks != null)
            {
                for (int idx = 0; idx < cacheAlertPullbacks.Length; idx++)
                {
                    if (cacheAlertPullbacks[idx].UseMACD == useMACD && cacheAlertPullbacks[idx].UseMomentum == useMomentum && cacheAlertPullbacks[idx].EqualsInput(input))
                    {
                        return(cacheAlertPullbacks[idx]);
                    }
                }
            }

            lock (checkAlertPullbacks)
            {
                checkAlertPullbacks.UseMACD = useMACD;
                useMACD = checkAlertPullbacks.UseMACD;
                checkAlertPullbacks.UseMomentum = useMomentum;
                useMomentum = checkAlertPullbacks.UseMomentum;

                if (cacheAlertPullbacks != null)
                {
                    for (int idx = 0; idx < cacheAlertPullbacks.Length; idx++)
                    {
                        if (cacheAlertPullbacks[idx].UseMACD == useMACD && cacheAlertPullbacks[idx].UseMomentum == useMomentum && cacheAlertPullbacks[idx].EqualsInput(input))
                        {
                            return(cacheAlertPullbacks[idx]);
                        }
                    }
                }

                AlertPullbacks indicator = new AlertPullbacks();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input       = input;
                indicator.UseMACD     = useMACD;
                indicator.UseMomentum = useMomentum;
                Indicators.Add(indicator);
                indicator.SetUp();

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