/// <summary> /// Variation of the VOL (Volume) indicator that colors the volume histogram different color depending if the current bar is up or down bar /// </summary> /// <returns></returns> public VolumeUpDown VolumeUpDown(Data.IDataSeries input) { if (cacheVolumeUpDown != null) { for (int idx = 0; idx < cacheVolumeUpDown.Length; idx++) { if (cacheVolumeUpDown[idx].EqualsInput(input)) { return(cacheVolumeUpDown[idx]); } } } lock (checkVolumeUpDown) { if (cacheVolumeUpDown != null) { for (int idx = 0; idx < cacheVolumeUpDown.Length; idx++) { if (cacheVolumeUpDown[idx].EqualsInput(input)) { return(cacheVolumeUpDown[idx]); } } } VolumeUpDown indicator = new VolumeUpDown(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; Indicators.Add(indicator); indicator.SetUp(); VolumeUpDown[] tmp = new VolumeUpDown[cacheVolumeUpDown == null ? 1 : cacheVolumeUpDown.Length + 1]; if (cacheVolumeUpDown != null) { cacheVolumeUpDown.CopyTo(tmp, 0); } tmp[tmp.Length - 1] = indicator; cacheVolumeUpDown = tmp; return(indicator); } }
/// <summary> /// Variation of the VOL (Volume) indicator that colors the volume histogram different color depending if the current bar is up or down bar /// </summary> /// <returns></returns> public VolumeUpDown VolumeUpDown(Data.IDataSeries input) { if (cacheVolumeUpDown != null) for (int idx = 0; idx < cacheVolumeUpDown.Length; idx++) if (cacheVolumeUpDown[idx].EqualsInput(input)) return cacheVolumeUpDown[idx]; lock (checkVolumeUpDown) { if (cacheVolumeUpDown != null) for (int idx = 0; idx < cacheVolumeUpDown.Length; idx++) if (cacheVolumeUpDown[idx].EqualsInput(input)) return cacheVolumeUpDown[idx]; VolumeUpDown indicator = new VolumeUpDown(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; Indicators.Add(indicator); indicator.SetUp(); VolumeUpDown[] tmp = new VolumeUpDown[cacheVolumeUpDown == null ? 1 : cacheVolumeUpDown.Length + 1]; if (cacheVolumeUpDown != null) cacheVolumeUpDown.CopyTo(tmp, 0); tmp[tmp.Length - 1] = indicator; cacheVolumeUpDown = tmp; return indicator; } }