/// <summary> /// VPIN indicator /// </summary> /// <returns></returns> public ZZVPIN ZZVPIN(Data.IDataSeries input, int sampleSize, int volBucketSize) { if (cacheZZVPIN != null) { for (int idx = 0; idx < cacheZZVPIN.Length; idx++) { if (cacheZZVPIN[idx].SampleSize == sampleSize && cacheZZVPIN[idx].VolBucketSize == volBucketSize && cacheZZVPIN[idx].EqualsInput(input)) { return(cacheZZVPIN[idx]); } } } lock (checkZZVPIN) { checkZZVPIN.SampleSize = sampleSize; sampleSize = checkZZVPIN.SampleSize; checkZZVPIN.VolBucketSize = volBucketSize; volBucketSize = checkZZVPIN.VolBucketSize; if (cacheZZVPIN != null) { for (int idx = 0; idx < cacheZZVPIN.Length; idx++) { if (cacheZZVPIN[idx].SampleSize == sampleSize && cacheZZVPIN[idx].VolBucketSize == volBucketSize && cacheZZVPIN[idx].EqualsInput(input)) { return(cacheZZVPIN[idx]); } } } ZZVPIN indicator = new ZZVPIN(); 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(); ZZVPIN[] tmp = new ZZVPIN[cacheZZVPIN == null ? 1 : cacheZZVPIN.Length + 1]; if (cacheZZVPIN != null) { cacheZZVPIN.CopyTo(tmp, 0); } tmp[tmp.Length - 1] = indicator; cacheZZVPIN = tmp; return(indicator); } }
/// <summary> /// VPIN indicator /// </summary> /// <returns></returns> public ZZVPIN ZZVPIN(Data.IDataSeries input, int sampleSize, int volBucketSize) { if (cacheZZVPIN != null) for (int idx = 0; idx < cacheZZVPIN.Length; idx++) if (cacheZZVPIN[idx].SampleSize == sampleSize && cacheZZVPIN[idx].VolBucketSize == volBucketSize && cacheZZVPIN[idx].EqualsInput(input)) return cacheZZVPIN[idx]; lock (checkZZVPIN) { checkZZVPIN.SampleSize = sampleSize; sampleSize = checkZZVPIN.SampleSize; checkZZVPIN.VolBucketSize = volBucketSize; volBucketSize = checkZZVPIN.VolBucketSize; if (cacheZZVPIN != null) for (int idx = 0; idx < cacheZZVPIN.Length; idx++) if (cacheZZVPIN[idx].SampleSize == sampleSize && cacheZZVPIN[idx].VolBucketSize == volBucketSize && cacheZZVPIN[idx].EqualsInput(input)) return cacheZZVPIN[idx]; ZZVPIN indicator = new ZZVPIN(); 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(); ZZVPIN[] tmp = new ZZVPIN[cacheZZVPIN == null ? 1 : cacheZZVPIN.Length + 1]; if (cacheZZVPIN != null) cacheZZVPIN.CopyTo(tmp, 0); tmp[tmp.Length - 1] = indicator; cacheZZVPIN = tmp; return indicator; } }