示例#1
0
        protected override void GenerateLabels()
        {
            if (PointInfos.Count > 3)
            {
                AddLabel(PointInfos[0], LabelVerticalAlignment, LabelHorizontalAlignment,
                         PointInfos[0].Series.TrackBallLabelTemplate);
                AddLabel(PointInfos[1], LabelVerticalAlignment, LabelHorizontalAlignment,
                         PointInfos[1].Series.TrackBallLabelTemplate);

                ChartPointInfo pointInfo1 = PointInfos[2];
                ChartPointInfo pointInfo2 = PointInfos[3];

                CustomLabel label = new CustomLabel();
                label.Value1 = pointInfo2.ValueY;
                label.Value2 = pointInfo1.ValueY;

                var actualYAxis = (pointInfo1.Series as ISupportAxes).ActualYAxis;
                if (actualYAxis != null)
                {
                    Rect rect = actualYAxis.ArrangeRect;
                    label.Axis = actualYAxis;
                    AddLabel(label, LabelVerticalAlignment, LabelHorizontalAlignment, CustomLabelTemplate, pointInfo1.X,
                             rect.Bottom);
                }
            }
        }
示例#2
0
        public void PeacemakerUpdate()
        {
            if (Manager == null)
            {
                return;
            }

            Rate rate = this.Rate;

            if (rate == null)
            {
                return;              // || rate.Frame == ServiceConfiguration.TimeFrame.LIVE) return;
            }
            ChartPoint[] ACPints;
            DataPoint[]  ADPoints;
            ChartPointInfo.DataPointType CPIDType = ChartPointInfo.DataPointType.Candle;
            SeriesChartType SCType = SeriesChartType.Candlestick;

            if (rate.Frame == ServiceConfiguration.TimeFrame.LIVE)
            {
                CPIDType = ChartPointInfo.DataPointType.AskLine;
                SCType   = SeriesChartType.Line;
            }



            if (RateInfo.EqualsOrigin(rate, RateOld))
            {
                int count = ChartMain.CountPoints(rate.Pair, this);
                ACPints = Manager.ForexArchive.GetChartPoints(rate, count);

                if (ACPints.Length <= 0)
                {
                    return;
                }

                ADPoints = ChartPointInfo.ToDataPoints(ACPints, CPIDType);
            }
            else
            {
                RateOld = rate;

                ChartMain.ClearSeries(this);
                ChartMain.Add(rate.Pair, SCType, this);

                if (SCType == SeriesChartType.Candlestick)
                {
                    ChartMain.SetCandlestickSettings(this, rate.Pair, Color.Green, Color.Red, Color.Black, Color.Transparent);
                }



                ACPints  = Manager.ForexArchive.GetChartPoints(rate);
                ADPoints = ChartPointInfo.ToDataPoints(ACPints, CPIDType);
            }

            ChartMain.AddRange(this, rate.Pair, ADPoints, ChartValueType.DateTime, ChartValueType.Double);
        }
示例#3
0
        public object Convert(object value, Type targetType, object parameter, string language)
        {
            if (value != null)
            {
                ChartPointInfo val = value as ChartPointInfo;
#pragma warning disable CA1305 // Specify IFormatProvider
                return(String.Format("$ {0}", val.ValueY));

#pragma warning restore CA1305 // Specify IFormatProvider
            }
            return(null);
        }
示例#4
0
        public object Convert(object value, Type targetType, object parameter, string language)
        {
            ChartPointInfo val = value as ChartPointInfo;

            return(String.Format("$ {0}", val.ValueY));
        }
 protected override void GenerateLabel(ChartPointInfo pointInfo, ChartAxis axis)
 {
 }
示例#6
0
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            ChartPointInfo val = value as ChartPointInfo;

            return(String.Format("$ {0}", val.ValueY));
        }
示例#7
0
        private void Peacemaker()
        {
            if (!IsFeed || !Manager.IsLoadedRate)
            {
                return;
            }


            string pair = this.Pair;

            ServiceConfiguration.TimeFrame frame = this.Frame;
            int    span       = this.Span;
            double confidence = this.Confidecne;
            int    tests      = TTbxBacktests.GetInt(this);

            Rate[] Rates = Manager.ForexArchive.Data.GetValuesArray <ServiceConfiguration.TimeFrame, DateTime, Rate>(pair, frame); //Manager.ForexArchive.Data[pair][ServiceConfiguration.TimeFrame.DAILY].ValuesArray;// //


            // TTbxMax.dec


            if (Objects.IsNullOrEmpty(Rates) || !ServiceConfiguration.IsSpan(frame))
            {
                return;
            }



            Manager.ForexAnalysis.MonteCarlo(pair, frame, span, tests);


            double[][] MonteCarloData = Manager.ForexAnalysis.GetMonteCarlo(pair, frame, span, -1);
            if (Objects.IsNullOrEmpty(MonteCarloData))
            {
                Chart.Main.ClearSeries(this);
                return;
            }

            double[]   data  = Objects.ToArray <double>(RateInfo.Extract(Rates, RateInfo.Properties.CLOSE));
            DateTime[] dates = Objects.ToArray <DateTime>(RateInfo.Extract(Rates, RateInfo.Properties.DateTime));


            double Min  = 0;
            double Avg  = 0;
            double Max  = 0;
            double Test = 0;

            Manager.ForexAnalysis.GetStatistics(pair, frame, span, confidence, ref Max, ref Avg, ref Min, ref Test);

            this.SetOutputStatistic(pair, Max, Avg, Min);
            TTbxBacktestConfidence.SetValue(this, Test);
            TTbxBacktestSamples.SetValue(this, Manager.ForexAnalysis.MonteCarloBacktestSamples);

            double[] next = MonteCarloData.Last();// MonteCarloSimulation.Next(data, 50).ToArray();
            if (next == null)
            {
                return;
            }

            TTbxTestSamples.SetValue(this, MonteCarloData.Length);

            List <double> combine = new List <double>();

            combine.AddRange(data);
            combine.AddRange(next);

            if (Chart.Main.Series.Count <= 0 || Chart.Main.Series[0].Name != pair || Chart.Main.ID != frame + pair + span + tests)
            {
                Chart.Main.ID = frame + pair + span + tests;
                Chart.Main.ClearSeries(this);
                Chart.Main.Add(pair, SeriesChartType.Line, this);
                DataPoint[] points = ChartPointInfo.ToDataPoints(data, dates, ServiceConfiguration.Span(frame));
                Chart.Main.AddRange(this, pair, points, ChartValueType.DateTime, ChartValueType.Double);
            }
            else
            {
                DataPoint[] points = ChartPointInfo.ToDataPoints(next, dates.Last(), ServiceConfiguration.Span(frame));
                Chart.Main.UpdateRange(this, pair, points, ChartValueType.DateTime, ChartValueType.Double);
            }
        }