Example #1
0
        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
            //};
        }
Example #2
0
 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();
 }
Example #3
0
 public virtual void OnBar(SymbolBar bar)
 {
 }
Example #4
0
 public void OnBar(string symbolCode, SymbolBar bar, TimeFrame timeFrame)
 {
     OnBar(symbolCode, timeFrame, new TimedBar(bar));
 }