27 private decimal _barSize;
28 private bool _evenBars;
29 private decimal? _lastCloseValue;
61 EpsilonCheck(barSize);
77 Func<IBaseData, decimal> selector,
78 Func<IBaseData, decimal> volumeSelector =
null,
80 : base(selector, volumeSelector)
82 EpsilonCheck(barSize);
92 [Obsolete(
"Please use the new RenkoConsolidator if RenkoType is not Classic")]
98 throw new ArgumentException(
"Please use the new RenkoConsolidator type if RenkoType is not Classic");
113 PyObject volumeSelector =
null,
114 bool evenBars =
true)
115 : base(selector, volumeSelector)
117 EpsilonCheck(barSize);
119 _evenBars = evenBars;
129 protected override void UpdateBar(DateTime time, decimal currentValue, decimal volume)
149 var open = _lastCloseValue ?? currentValue;
150 if (_evenBars && !_lastCloseValue.HasValue)
152 open = Math.Ceiling(open / _barSize) * _barSize;
158 private static void EpsilonCheck(decimal barSize)
162 throw new ArgumentOutOfRangeException(nameof(barSize),
163 "RenkoConsolidator bar size must be positve and greater than 1e-28");
186 Func<TInput, decimal> selector,
187 Func<TInput, decimal> volumeSelector =
null,
190 : base(barSize, x => selector((TInput) x),
191 volumeSelector == null ? (Func<
IBaseData, decimal>) null : x => volumeSelector((TInput) x), evenBars)
203 : this(barSize, x => x.Value, x => 0, evenBars)
214 [Obsolete(
"Please use the WickedRenkoConsolidator if RenkoType is not Classic")]
216 : base(barSize, type)