29 private bool _firstTick =
true;
63 protected DateTime
OpenOn {
get;
set; }
103 get {
return _consolidated; }
104 private set { _consolidated = value; }
117 add { _dataConsolidatedHandler += value; }
118 remove { _dataConsolidatedHandler -= value; }
129 throw new ArgumentException(
"Renko consolidator BarSize must be strictly greater than zero");
141 var rate = data.
Price;
232 public void Scan(DateTime currentLocalTime)
240 DataConsolidated =
null;
241 _dataConsolidatedHandler =
null;
251 DataConsolidated?.Invoke(
this, consolidated);
252 _currentBar = consolidated;
253 _dataConsolidatedHandler?.Invoke(
this, consolidated);
261 while (CloseRate > (limit = OpenRate + BarSize))
263 var wicko =
new RenkoBar(data.
Symbol, OpenOn, CloseOn, BarSize, OpenRate, limit, LowRate, limit);
267 OnDataConsolidated(wicko);
275 private void Falling(IBaseData data)
279 while (CloseRate < (limit = OpenRate - BarSize))
281 var wicko =
new RenkoBar(data.Symbol, OpenOn, CloseOn, BarSize, OpenRate, HighRate, limit, limit);
285 OnDataConsolidated(wicko);
304 throw new ArgumentException(
"BarSize must be strictly greater than zero");
307 var modulus = price - barSize * Math.Floor(price / barSize);
308 var round = Math.Round(modulus / barSize);
309 return barSize * (Math.Floor(price / barSize) + round);