public TimedBar Merge(SymbolBar nextSymbolBar) { var nextBar = nextSymbolBar.Bar; var current = this; if (nextSymbolBar.Time != default(DateTime)) { High = Math.Max(current.High, nextBar.High); Low = Math.Min(current.Low, nextBar.Low); Close = nextBar.Close; Volume = current.Volume + nextBar.Volume; } return(this); //return new TimedBar //{ // OpenTime = current.OpenTime, // Open = current.Open, // Close = next.Close, // High = Math.Max(current.High, next.High), // Low = Math.Min(current.Low, next.Low), // Volume = current.Volume + next.Volume //}; }
public TimedBar(SymbolBar b) { this.OpenTime = b.Time; this.High = b.Bar.High; this.Low = b.Bar.Low; this.open = b.Bar.Open; this.Close = b.Bar.Close; this.Volume = b.Bar.Volume; Validate(); }
public virtual void OnBar(SymbolBar bar) { }
public void OnBar(string symbolCode, SymbolBar bar, TimeFrame timeFrame) { OnBar(symbolCode, timeFrame, new TimedBar(bar)); }