/// <summary> /// The VROC (Volume Rate-of-Change) shows whether or not a volume trend is developing in either an up or down direction. It is similar to the ROC indicator, but is applied to volume instead. /// </summary> /// <returns></returns> public VROC VROC(Data.IDataSeries input, int period, int smooth) { if (cacheVROC != null) { for (int idx = 0; idx < cacheVROC.Length; idx++) { if (cacheVROC[idx].Period == period && cacheVROC[idx].Smooth == smooth && cacheVROC[idx].EqualsInput(input)) { return(cacheVROC[idx]); } } } lock (checkVROC) { checkVROC.Period = period; period = checkVROC.Period; checkVROC.Smooth = smooth; smooth = checkVROC.Smooth; if (cacheVROC != null) { for (int idx = 0; idx < cacheVROC.Length; idx++) { if (cacheVROC[idx].Period == period && cacheVROC[idx].Smooth == smooth && cacheVROC[idx].EqualsInput(input)) { return(cacheVROC[idx]); } } } VROC indicator = new VROC(); 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(); VROC[] tmp = new VROC[cacheVROC == null ? 1 : cacheVROC.Length + 1]; if (cacheVROC != null) { cacheVROC.CopyTo(tmp, 0); } tmp[tmp.Length - 1] = indicator; cacheVROC = tmp; return(indicator); } }
/// <summary> /// The VROC (Volume Rate-of-Change) shows whether or not a volume trend is developing in either an up or down direction. It is similar to the ROC indicator, but is applied to volume instead. /// </summary> /// <returns></returns> public VROC VROC(Data.IDataSeries input, int period, int smooth) { if (cacheVROC != null) for (int idx = 0; idx < cacheVROC.Length; idx++) if (cacheVROC[idx].Period == period && cacheVROC[idx].Smooth == smooth && cacheVROC[idx].EqualsInput(input)) return cacheVROC[idx]; lock (checkVROC) { checkVROC.Period = period; period = checkVROC.Period; checkVROC.Smooth = smooth; smooth = checkVROC.Smooth; if (cacheVROC != null) for (int idx = 0; idx < cacheVROC.Length; idx++) if (cacheVROC[idx].Period == period && cacheVROC[idx].Smooth == smooth && cacheVROC[idx].EqualsInput(input)) return cacheVROC[idx]; VROC indicator = new VROC(); 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(); VROC[] tmp = new VROC[cacheVROC == null ? 1 : cacheVROC.Length + 1]; if (cacheVROC != null) cacheVROC.CopyTo(tmp, 0); tmp[tmp.Length - 1] = indicator; cacheVROC = tmp; return indicator; } }