private void gridView1_CustomScrollAnnotation(object sender, DevExpress.XtraGrid.Views.Grid.GridCustomScrollAnnotationsEventArgs e)
        {
            List <TripleRsiStrategyHistoryItem> st = this.tripleRsiStrategyHistoryItemBindingSource.DataSource as List <TripleRsiStrategyHistoryItem>;

            e.Annotations = new List <GridScrollAnnotationInfo>();
            if (st == null && e.Annotations != null)
            {
                e.Annotations.Clear();
                return;
            }
            for (int i = 0; i < st.Count; i++)
            {
                if (st[i].TimeToBuy)
                {
                    GridScrollAnnotationInfo info = new GridScrollAnnotationInfo();
                    info.Index     = i;
                    info.RowHandle = this.gridView1.GetRowHandle(i);
                    info.Color     = Color.Green;
                    e.Annotations.Add(info);
                }

                if (st[i].TimeToSell)
                {
                    GridScrollAnnotationInfo info = new GridScrollAnnotationInfo();
                    info.Index     = i;
                    info.RowHandle = this.gridView1.GetRowHandle(i);
                    info.Color     = Color.Red;
                    e.Annotations.Add(info);
                }
            }
        }
        private void gvData_CustomScrollAnnotation(object sender, DevExpress.XtraGrid.Views.Grid.GridCustomScrollAnnotationsEventArgs e)
        {
            List <object> st = Strategy.StrategyData as List <object>;

            if (st.Count == 0)
            {
                return;
            }
            PropertyInfo pBuy  = st[0].GetType().GetProperty("BuySignal", BindingFlags.Public | BindingFlags.Instance);
            PropertyInfo pSell = st[0].GetType().GetProperty("SellSignal", BindingFlags.Public | BindingFlags.Instance);

            if (pBuy == null || pSell == null)
            {
                return;
            }

            e.Annotations = new List <GridScrollAnnotationInfo>();
            if (st == null && e.Annotations != null)
            {
                e.Annotations.Clear();
                return;
            }
            for (int i = 0; i < st.Count; i++)
            {
                if ((bool)pBuy.GetValue(st[i]))
                {
                    GridScrollAnnotationInfo info = new GridScrollAnnotationInfo();
                    info.Index     = i;
                    info.RowHandle = this.gridView1.GetRowHandle(i);
                    info.Color     = Color.Green;
                    e.Annotations.Add(info);
                }

                if ((bool)pSell.GetValue(st[i]))
                {
                    GridScrollAnnotationInfo info = new GridScrollAnnotationInfo();
                    info.Index     = i;
                    info.RowHandle = this.gridView1.GetRowHandle(i);
                    info.Color     = Color.Red;
                    e.Annotations.Add(info);
                }
            }
        }
Пример #3
0
        private void gridView2_CustomScrollAnnotation(object sender, DevExpress.XtraGrid.Views.Grid.GridCustomScrollAnnotationsEventArgs e)
        {
            if (CpItems == null)
            {
                return;
            }
            e.Annotations = new List <DevExpress.XtraGrid.Views.Grid.GridScrollAnnotationInfo>();
            int index = 0;

            foreach (var item in CpItems)
            {
                if (item.Match)
                {
                    e.Annotations.Add(new DevExpress.XtraGrid.Views.Grid.GridScrollAnnotationInfo()
                    {
                        Color = Color.LightGreen, Index = index, RowHandle = this.gridView1.GetRowHandle(index)
                    });
                }
                index++;
            }
        }