/// <summary> /// VPIN indicator /// </summary> /// <returns></returns> public ZZVPINwithMinuteBar ZZVPINwithMinuteBar(Data.IDataSeries input, int cdfsamplesize, int sampleSize, int volBucketSize) { if (cacheZZVPINwithMinuteBar != null) { for (int idx = 0; idx < cacheZZVPINwithMinuteBar.Length; idx++) { if (cacheZZVPINwithMinuteBar[idx].Cdfsamplesize == cdfsamplesize && cacheZZVPINwithMinuteBar[idx].SampleSize == sampleSize && cacheZZVPINwithMinuteBar[idx].VolBucketSize == volBucketSize && cacheZZVPINwithMinuteBar[idx].EqualsInput(input)) { return(cacheZZVPINwithMinuteBar[idx]); } } } lock (checkZZVPINwithMinuteBar) { checkZZVPINwithMinuteBar.Cdfsamplesize = cdfsamplesize; cdfsamplesize = checkZZVPINwithMinuteBar.Cdfsamplesize; checkZZVPINwithMinuteBar.SampleSize = sampleSize; sampleSize = checkZZVPINwithMinuteBar.SampleSize; checkZZVPINwithMinuteBar.VolBucketSize = volBucketSize; volBucketSize = checkZZVPINwithMinuteBar.VolBucketSize; if (cacheZZVPINwithMinuteBar != null) { for (int idx = 0; idx < cacheZZVPINwithMinuteBar.Length; idx++) { if (cacheZZVPINwithMinuteBar[idx].Cdfsamplesize == cdfsamplesize && cacheZZVPINwithMinuteBar[idx].SampleSize == sampleSize && cacheZZVPINwithMinuteBar[idx].VolBucketSize == volBucketSize && cacheZZVPINwithMinuteBar[idx].EqualsInput(input)) { return(cacheZZVPINwithMinuteBar[idx]); } } } ZZVPINwithMinuteBar indicator = new ZZVPINwithMinuteBar(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; indicator.Cdfsamplesize = cdfsamplesize; indicator.SampleSize = sampleSize; indicator.VolBucketSize = volBucketSize; Indicators.Add(indicator); indicator.SetUp(); ZZVPINwithMinuteBar[] tmp = new ZZVPINwithMinuteBar[cacheZZVPINwithMinuteBar == null ? 1 : cacheZZVPINwithMinuteBar.Length + 1]; if (cacheZZVPINwithMinuteBar != null) { cacheZZVPINwithMinuteBar.CopyTo(tmp, 0); } tmp[tmp.Length - 1] = indicator; cacheZZVPINwithMinuteBar = tmp; return(indicator); } }
/// <summary> /// VPIN indicator /// </summary> /// <returns></returns> public ZZVPINwithMinuteBar ZZVPINwithMinuteBar(Data.IDataSeries input, int cdfsamplesize, int sampleSize, int volBucketSize) { if (cacheZZVPINwithMinuteBar != null) for (int idx = 0; idx < cacheZZVPINwithMinuteBar.Length; idx++) if (cacheZZVPINwithMinuteBar[idx].Cdfsamplesize == cdfsamplesize && cacheZZVPINwithMinuteBar[idx].SampleSize == sampleSize && cacheZZVPINwithMinuteBar[idx].VolBucketSize == volBucketSize && cacheZZVPINwithMinuteBar[idx].EqualsInput(input)) return cacheZZVPINwithMinuteBar[idx]; lock (checkZZVPINwithMinuteBar) { checkZZVPINwithMinuteBar.Cdfsamplesize = cdfsamplesize; cdfsamplesize = checkZZVPINwithMinuteBar.Cdfsamplesize; checkZZVPINwithMinuteBar.SampleSize = sampleSize; sampleSize = checkZZVPINwithMinuteBar.SampleSize; checkZZVPINwithMinuteBar.VolBucketSize = volBucketSize; volBucketSize = checkZZVPINwithMinuteBar.VolBucketSize; if (cacheZZVPINwithMinuteBar != null) for (int idx = 0; idx < cacheZZVPINwithMinuteBar.Length; idx++) if (cacheZZVPINwithMinuteBar[idx].Cdfsamplesize == cdfsamplesize && cacheZZVPINwithMinuteBar[idx].SampleSize == sampleSize && cacheZZVPINwithMinuteBar[idx].VolBucketSize == volBucketSize && cacheZZVPINwithMinuteBar[idx].EqualsInput(input)) return cacheZZVPINwithMinuteBar[idx]; ZZVPINwithMinuteBar indicator = new ZZVPINwithMinuteBar(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; indicator.Cdfsamplesize = cdfsamplesize; indicator.SampleSize = sampleSize; indicator.VolBucketSize = volBucketSize; Indicators.Add(indicator); indicator.SetUp(); ZZVPINwithMinuteBar[] tmp = new ZZVPINwithMinuteBar[cacheZZVPINwithMinuteBar == null ? 1 : cacheZZVPINwithMinuteBar.Length + 1]; if (cacheZZVPINwithMinuteBar != null) cacheZZVPINwithMinuteBar.CopyTo(tmp, 0); tmp[tmp.Length - 1] = indicator; cacheZZVPINwithMinuteBar = tmp; return indicator; } }