示例#1
0
        private void btnLoadData_Click(object sender, EventArgs e)
        {
            string itemCode = ItemCodeSet.GetItemCode(ItemCode.지수_국내_코스피200);

            var list = PPContext.Instance.ClientContext.GetSourceData(
                itemCode
                , Lib.Base.Enums.TimeIntervalEnum.Day
                , null
                , tbDT_E.Text
                , 120);

            int round = ItemCodeUtil.GetItemCodeRoundNum(itemCode);

            List <S_CandleItemData>  sourceDatas       = new List <S_CandleItemData>();
            List <T_AtomItemData>    transformedDatas  = new List <T_AtomItemData>();
            List <T_QuantumItemData> transformedDatas2 = new List <T_QuantumItemData>();

            foreach (var m in list)
            {
                S_CandleItemData sourceData = new S_CandleItemData(
                    itemCode
                    , (Single)Math.Round(m.OpenVal, round)
                    , (Single)Math.Round(m.HighVal, round)
                    , (Single)Math.Round(m.LowVal, round)
                    , (Single)Math.Round(m.CloseVal, round)
                    , m.Volume
                    , m.DT
                    );

                sourceDatas.Add(sourceData);
            }

            int itemsCnt = 7;

            for (int i = itemsCnt; i < sourceDatas.Count; i++)
            {
                T_AtomItemData transData = new T_AtomItemData(sourceDatas[i], sourceDatas.GetRange(i - itemsCnt, itemsCnt));
                transData.Transform();
                transformedDatas.Add(transData);
            }
            chartAT1.LoadData(itemCode, transformedDatas);


            itemsCnt = 7;
            for (int i = itemsCnt; i < sourceDatas.Count; i++)
            {
                T_QuantumItemData transData = new T_QuantumItemData(sourceDatas[i], sourceDatas.GetRange(i - itemsCnt, itemsCnt));
                transData.Transform();
                transformedDatas2.Add(transData);
            }
            chartQL1.LoadData(itemCode, transformedDatas2);
        }
示例#2
0
        public void DisplayPattern(T_QuantumItemData item, Color color, string type, string title = "")
        {
            int idx = 0;

            foreach (var p in chart.Series[0].Points)
            {
                var pItem = p.Tag as T_QuantumItemData;

                if (pItem == item)
                {
                    //if (item.PlusMinusType == PlusMinusTypeEnum.양)
                    //    SetDataPointColor(p, color, color, color, 2);
                    //else if (item.PlusMinusType == PlusMinusTypeEnum.음)
                    //    SetDataPointColor(p, color, color, color, 2);

                    p.Label         += Environment.NewLine + title;
                    p.LabelForeColor = color;
                    break;
                }
                idx++;
            }
        }
示例#3
0
        public override void View()
        {
            pnlScroll.Visible = IsAutoScrollX;
            if (ChartData == null)
            {
                return;
            }

            T_QuantumItemData bItem = null;

            for (int i = 0; i < ChartData.Count; i++)
            {
                var item = ChartData[i];
                int idx  = chart.Series[0].Points.AddXY(item.DTime, item.HighPrice, item.LowPrice, item.OpenPrice, item.ClosePrice);


                item = ChartDataSub[i];
                string diceChar = getDiceChar(item);
                chart.Series[0].Points[idx].Label = diceChar;

                chart.Series[1].Points.AddXY(item.DTime, item.T_MassAvg);
                chart.Series[2].Points.AddXY(item.DTime, item.T_QuantumAvg);
                chart.Series[3].Points.AddXY(item.DTime, 0);

                if (bItem != null)
                {
                    bool isSignal = false;
                    if (item.T_MassAvg < item.T_QuantumAvg)
                    {
                        if (item.T_QuantumAvg < item.LowPrice)
                        {
                            isSignal = true;
                        }
                        if (item.T_MassAvg > item.HighPrice)
                        {
                            isSignal = true;
                        }
                    }
                    if (item.T_MassAvg > item.T_QuantumAvg)
                    {
                        if (item.T_QuantumAvg > item.HighPrice)
                        {
                            isSignal = true;
                        }
                        if (item.T_MassAvg < item.LowPrice)
                        {
                            isSignal = true;
                        }
                    }

                    if (bItem.DiceNum + item.DiceNum == 7 && isSignal)
                    {
                        chart.Series[3].Points[idx].Label = "↑";
                    }
                }

                bItem = item;
            }

            //maxPrice = ChartData.Max(m => m.HighPrice);
            //minPrice = ChartData.Min(m => m.LowPrice);

            //double maxPrice2 = ChartData.Max(m => m.T_QuantumHighAvg);
            //double minPrice2 = ChartData.Min(m => m.T_QuantumLowAvg);
            //if (maxPrice < maxPrice2) maxPrice = maxPrice2;
            //if (minPrice > minPrice2) minPrice = minPrice2;
            //maxPrice2 = ChartData.Max(m => m.T_CloseAvg);
            //minPrice2 = ChartData.Min(m => m.T_CloseAvg);
            //if (maxPrice < maxPrice2) maxPrice = maxPrice2;
            //if (minPrice > minPrice2) minPrice = minPrice2;
            //maxPrice2 = ChartData.Max(m => m.T_QuantumAvg);
            //minPrice2 = ChartData.Min(m => m.T_QuantumAvg);
            //if (maxPrice < maxPrice2) maxPrice = maxPrice2;
            //if (minPrice > minPrice2) minPrice = minPrice2;

            //maxPrice = maxPrice + SpaceMaxMin;
            //minPrice = minPrice - SpaceMaxMin;
            //chart.ChartAreas[0].AxisY2.Maximum = maxPrice;
            //chart.ChartAreas[0].AxisY2.Minimum = minPrice;
            //chart.ChartAreas[0].AxisY.Maximum = 10000;
            //chart.ChartAreas[0].AxisY.Minimum = 0;

            SetTrackBar();
            SetScrollBar();

            DisplayView();

            IsLoaded = true;

            base.View();
        }
示例#4
0
        public override void View()
        {
            pnlScroll.Visible = IsAutoScrollX;

            if (ChartData == null)
            {
                return;
            }
            if (ChartDataSub == null)
            {
                return;
            }

            if (IsShowCandle)
            {
                chart.Series[3].Enabled = chart.Series[4].Enabled = false;
            }

            int bDistance           = -1;
            T_QuantumItemData bItem = null;

            for (int i = 0; i < ChartData.Count; i++)
            {
                var item = ChartData[i];
                int idx  = chart.Series[0].Points.AddXY(item.DTime, item.HighPrice, item.LowPrice, item.OpenPrice, item.ClosePrice);

                item = ChartDataSub[i];
                if (IsShowCandle)
                {
                    chart.Series[1].Points.AddXY(item.DTime, item.T_MassAvg);
                    chart.Series[2].Points.AddXY(item.DTime, item.T_QuantumAvg);
                }
                else
                {
                    chart.Series[1].Points.AddXY(item.DTime, item.T_OpenAvg);
                    chart.Series[2].Points.AddXY(item.DTime, item.T_CloseAvg);
                    chart.Series[3].Points.AddXY(item.DTime, item.T_VikalaAvg);
                    chart.Series[4].Points.AddXY(item.DTime, item.T_QuantumAvg);
                }

                int d = PriceTick.GetTickDiff(ItemCode, item.MassPrice, item.TotalCenterPrice);
                chart.Series[5].Points.AddXY(item.DTime, d);

                if (bDistance != -1)
                {
                    if (d > bDistance)
                    {
                        chart.Series[5].Points[idx].Color = Color.DarkRed;
                    }
                    else
                    {
                        chart.Series[5].Points[idx].Color = Color.DarkBlue;
                    }
                }

                if (d == 0 && bItem != null)
                {
                    var p = chart.Series[5].Points[idx];

                    bool isSignal = false;
                    if (item.T_MassAvg < item.T_QuantumAvg)
                    {
                        if (item.T_QuantumAvg < item.LowPrice)
                        {
                            isSignal = true;
                        }
                        if (item.T_MassAvg > item.HighPrice)
                        {
                            isSignal = true;
                        }
                    }
                    if (item.T_MassAvg > item.T_QuantumAvg)
                    {
                        if (item.T_QuantumAvg > item.HighPrice)
                        {
                            isSignal = true;
                        }
                        if (item.T_MassAvg < item.LowPrice)
                        {
                            isSignal = true;
                        }
                    }

                    if (isSignal)
                    {
                        p.Label = "↑";
                    }
                }
                bDistance = d;

                var dataPoint = chart.Series[0].Points[idx];

                bItem = item;
            }


            //maxPrice = ChartData.Max(m => m.HighPrice);
            //minPrice = ChartData.Min(m => m.LowPrice);

            //double maxPrice2 = ChartData.Max(m => m.T_QuantumHighAvg);
            //double minPrice2 = ChartData.Min(m => m.T_QuantumLowAvg);
            //if (maxPrice < maxPrice2) maxPrice = maxPrice2;
            //if (minPrice > minPrice2) minPrice = minPrice2;
            //maxPrice2 = ChartData.Max(m => m.T_CloseAvg);
            //minPrice2 = ChartData.Min(m => m.T_CloseAvg);
            //if (maxPrice < maxPrice2) maxPrice = maxPrice2;
            //if (minPrice > minPrice2) minPrice = minPrice2;
            //maxPrice2 = ChartData.Max(m => m.T_QuantumAvg);
            //minPrice2 = ChartData.Min(m => m.T_QuantumAvg);
            //if (maxPrice < maxPrice2) maxPrice = maxPrice2;
            //if (minPrice > minPrice2) minPrice = minPrice2;

            //maxPrice = maxPrice + SpaceMaxMin;
            //minPrice = minPrice - SpaceMaxMin;
            //chart.ChartAreas[0].AxisY2.Maximum = maxPrice;
            //chart.ChartAreas[0].AxisY2.Minimum = minPrice;
            //chart.ChartAreas[0].AxisY.Maximum = 10000;
            //chart.ChartAreas[0].AxisY.Minimum = 0;

            SetTrackBar();
            SetScrollBar();

            DisplayView();

            IsLoaded = true;

            base.View();
        }