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;
128 _lastCloseValue =
null;
138 protected override void UpdateBar(DateTime time, decimal currentValue, decimal volume)
158 var open = _lastCloseValue ?? currentValue;
159 if (_evenBars && !_lastCloseValue.HasValue)
161 open = Math.Ceiling(open / _barSize) * _barSize;
167 private static void EpsilonCheck(decimal barSize)
171 throw new ArgumentOutOfRangeException(nameof(barSize),
172 "RenkoConsolidator bar size must be positve and greater than 1e-28");
195 Func<TInput, decimal> selector,
196 Func<TInput, decimal> volumeSelector =
null,
199 : base(barSize, x => selector((TInput) x),
200 volumeSelector == null ? (Func<
IBaseData, decimal>) null : x => volumeSelector((TInput) x), evenBars)
212 : this(barSize, x => x.Value, x => 0, evenBars)
223 [Obsolete(
"Please use the WickedRenkoConsolidator if RenkoType is not Classic")]
225 : base(barSize, type)