コード例 #1
0
        public void TimerOnTick(object sender, EventArgs eventArgs)
        {
            var now = DateTime.Now;

            double liveValuePrice   = 0;
            double liveValueLongMA  = 0;
            double liveValueShortMA = 0;

            if (StrategyTwoMA != null)
            {
                liveValuePrice   = StrategyTwoMA.Price;
                liveValueLongMA  = StrategyTwoMA.LongMAPrice;
                liveValueShortMA = StrategyTwoMA.ShortMAPrice;
            }

            ChartValuesPrice.Add(new MeasureModel
            {
                DateTime = now,
                Value    = liveValuePrice
            });

            ChartValuesLongMA.Add(new MeasureModel
            {
                DateTime = now,
                Value    = liveValueLongMA
            });

            ChartValuesShortMA.Add(new MeasureModel
            {
                DateTime = now,
                Value    = liveValueShortMA
            });

            SetAxisLimits(now);

            //lets only use the last 100 values
            if (ChartValuesPrice.Count > 100)
            {
                ChartValuesPrice.RemoveAt(0);
            }

            if (ChartValuesLongMA.Count > 100)
            {
                ChartValuesLongMA.RemoveAt(0);
            }

            if (ChartValuesShortMA.Count > 100)
            {
                ChartValuesShortMA.RemoveAt(0);
            }
        }
コード例 #2
0
        public void TimerOnTick(object sender, EventArgs eventArgs)
        {
            var now = DateTime.Now;

            double livePriceValue = 0;

            //double liveAskValue = 0;
            //double liveBidValue = 0;

            if (SLiveFeed != null)
            {
                livePriceValue = SLiveFeed.Price;
                //liveAskValue = SLiveFeed.Ask;
                //liveBidValue = SLiveFeed.Bid;
            }

            ChartValuesPrice.Add(new MeasureModel
            {
                DateTime = now,
                Value    = livePriceValue
            });

            //ChartValuesAsk.Add(new MeasureModel
            //{
            //    DateTime = now,
            //    Value = liveAskValue
            //});

            //ChartValuesBid.Add(new MeasureModel
            //{
            //    DateTime = now,
            //    Value = liveBidValue
            //});

            SetAxisLimits(now);

            //lets only use the last 100 values
            if (ChartValuesPrice.Count > 100)
            {
                ChartValuesPrice.RemoveAt(0);
            }
        }
コード例 #3
0
        public void TimerOnTick(object sender, EventArgs eventArgs)
        {
            var now = DateTime.Now;

            double liveValuePrice      = 0;
            double liveValueUpperBand  = 0;
            double liveValueMiddleBand = 0;
            double liveValueLowerBand  = 0;

            if (StrategyBollingerBands != null)
            {
                liveValuePrice      = StrategyBollingerBands.Price;
                liveValueUpperBand  = StrategyBollingerBands.UpperBand;
                liveValueMiddleBand = StrategyBollingerBands.MiddleBand;
                liveValueLowerBand  = StrategyBollingerBands.LowerBand;
            }

            ChartValuesPrice.Add(new MeasureModel
            {
                DateTime = now,
                Value    = liveValuePrice
            });

            ChartValuesUpperBand.Add(new MeasureModel
            {
                DateTime = now,
                Value    = liveValueUpperBand
            });

            ChartValuesMiddleBand.Add(new MeasureModel
            {
                DateTime = now,
                Value    = liveValueMiddleBand
            });

            ChartValuesLowerBand.Add(new MeasureModel
            {
                DateTime = now,
                Value    = liveValueLowerBand
            });

            SetAxisLimits(now);

            //lets only use the last 100 values
            if (ChartValuesPrice.Count > 100)
            {
                ChartValuesPrice.RemoveAt(0);
            }

            if (ChartValuesUpperBand.Count > 100)
            {
                ChartValuesUpperBand.RemoveAt(0);
            }

            if (ChartValuesMiddleBand.Count > 100)
            {
                ChartValuesMiddleBand.RemoveAt(0);
            }

            if (ChartValuesLowerBand.Count > 100)
            {
                ChartValuesLowerBand.RemoveAt(0);
            }
        }