Ejemplo n.º 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
            //};
        }
Ejemplo n.º 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();
 }
Ejemplo n.º 3
0
 public virtual void OnBar(SymbolBar bar)
 {
 }
Ejemplo n.º 4
0
 public void OnBar(string symbolCode, SymbolBar bar, TimeFrame timeFrame)
 {
     OnBar(symbolCode, timeFrame, new TimedBar(bar));
 }