示例#1
0
        /// <summary>
        /// stochastic computation
        /// </summary>
        /// <returns></returns>
        public zStochastic zStochastic(Data.IDataSeries input, int length, bool useJustInput)
        {
            if (cachezStochastic != null)
            {
                for (int idx = 0; idx < cachezStochastic.Length; idx++)
                {
                    if (cachezStochastic[idx].Length == length && cachezStochastic[idx].UseJustInput == useJustInput && cachezStochastic[idx].EqualsInput(input))
                    {
                        return(cachezStochastic[idx]);
                    }
                }
            }

            lock (checkzStochastic)
            {
                checkzStochastic.Length = length;
                length = checkzStochastic.Length;
                checkzStochastic.UseJustInput = useJustInput;
                useJustInput = checkzStochastic.UseJustInput;

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

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

                zStochastic[] tmp = new zStochastic[cachezStochastic == null ? 1 : cachezStochastic.Length + 1];
                if (cachezStochastic != null)
                {
                    cachezStochastic.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cachezStochastic    = tmp;
                return(indicator);
            }
        }
示例#2
0
 protected override void OnStartUp()
 {
     myadx   = this.ZADX(aDXLen, adxType, 1.0, RWT_HA.SecondaryOHLC.NONE, (useJustInput?RWT_HA.PrimaryOHLC.INPUTS:RWT_HA.PrimaryOHLC.BARS), aDXLen, dmType);
     mystoch = this.zStochastic(myadx.ADX, windowLength, true);
 }