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;
252 _consolidated =
null;
268 DataConsolidated?.Invoke(
this, consolidated);
269 _currentBar = consolidated;
270 _dataConsolidatedHandler?.Invoke(
this, consolidated);
278 while (CloseRate > (limit = OpenRate + BarSize))
280 var wicko =
new RenkoBar(data.
Symbol, OpenOn, CloseOn, BarSize, OpenRate, limit, LowRate, limit);
284 OnDataConsolidated(wicko);
292 private void Falling(IBaseData data)
296 while (CloseRate < (limit = OpenRate - BarSize))
298 var wicko =
new RenkoBar(data.Symbol, OpenOn, CloseOn, BarSize, OpenRate, HighRate, limit, limit);
302 OnDataConsolidated(wicko);
321 throw new ArgumentException(
"BarSize must be strictly greater than zero");
324 var modulus = price - barSize * Math.Floor(price / barSize);
325 var round = Math.Round(modulus / barSize);
326 return barSize * (Math.Floor(price / barSize) + round);