Exemplo n.º 1
0
 private void FillAcelerationFields(Acceleration toRet, PatternEvent item)
 {
     toRet.Id                 = item.Id;
     toRet.Confidence         = item.Confidence;
     toRet.Height             = item.Height;
     toRet.IsNonInterpretable = item.IsNonInterpretable;
     toRet.PeakTime           = item.PeakTime.ToLocalTime();
     toRet.PeakValue          = item.PeakValue;
     toRet.Repair             = item.Repair;
 }
Exemplo n.º 2
0
        private void CandleProvider_PatternUpdate(object sender, PatternEvent e)
        {
            Console.WriteLine("Strategy received pattern detection  : {0} for candle time : {1}", e.EventType, e.ComingCandle.CollectedDate);
            switch (e.EventType)
            {
            case PatternType.IsBearish:
                this.Actions.SellPrice = this.CandleProvider.Close.Last();
                Console.WriteLine("Strategy selling at : {0}", this.Actions.SellPrice);
                this.Actions.Sell();
                this.Actions.Update();
                break;

            case PatternType.IsBullish:
                if (!this.Actions.HasBought)
                {
                    this.Actions.BuyPrice  = this.CandleProvider.Close.Last();
                    this.Actions.HasBought = true;
                    this.Actions.Update();
                    Console.WriteLine("Strategy buying at : {0}", this.Actions.BuyPrice);
                }
                break;
            }
        }