Ejemplo n.º 1
0
        public override void loadData()
        {
            if (base.SelectedItemData == null)
            {
                return;
            }
            if (string.IsNullOrEmpty(base.SelectedItemData.Code))
            {
                return;
            }

            string itemCode = base.SelectedItemData.Code;

            var sourceDatas = PPContext.Instance.ClientContext.GetCandleSourceDataOrderByAsc(
                itemCode
                , base.timeInterval);

            if (sourceDatas == null || sourceDatas.Count == 0)
            {
                return;
            }

            //표시할 갯수를 맞춘다.
            //RemoveSourceData(sourceDatas);

            bool isUseWhim = false;

            if (isUseWhim)
            {
                double rate = 0.0;
                if (timeInterval == TimeIntervalEnum.Week)
                {
                    rate = 2.5;
                }
                if (timeInterval == TimeIntervalEnum.Day)
                {
                    rate = 1.0;
                }
                if (timeInterval == TimeIntervalEnum.Hour_03)
                {
                    rate = 0.7;
                }
                if (timeInterval == TimeIntervalEnum.Hour_02)
                {
                    rate = 0.5;
                }
                if (timeInterval == TimeIntervalEnum.Hour_01)
                {
                    rate = 0.3;
                }
                sourceDatas = PPUtils.GetRecreateWhimDatas(itemCode, sourceDatas, true, rate, null);
            }


            List <S_CandleItemData> averageDatas = null;

            if (averageType == "일반")
            {
                averageDatas = PPUtils.GetAverageDatas(itemCode, sourceDatas, 9);
            }
            else if (averageType == "밸런스")
            {
                averageDatas = PPUtils.GetBalancedAverageDatas(itemCode, sourceDatas, 9);
            }
            else //if (averageType == "가중")
            {
                averageDatas = PPUtils.GetAccumulatedAverageDatas(itemCode, sourceDatas, 9);
            }

            var averageDatas2 = PPUtils.GetMovingAverageDurationFlow(itemCode, averageDatas, isStrengthed, inflectionPoint);
            var sourceDatas2  = PPUtils.GetDurationSum(itemCode, averageDatas2, sourceDatas);

            chart.LoadDataAndApply(itemCode, sourceDatas2, base.timeInterval, 9);
            chart2.LoadDataAndApply(itemCode, averageDatas2, base.timeInterval, 9);

            chart2.SetYFormat("N0");
        }
Ejemplo n.º 2
0
        public override void loadData()
        {
            if (base.SelectedItemData == null)
            {
                return;
            }
            if (string.IsNullOrEmpty(base.SelectedItemData.Code))
            {
                return;
            }

            string itemCode = base.SelectedItemData.Code;

            var sourceDatas = PPContext.Instance.ClientContext.GetCandleSourceDataOrderByAsc(
                itemCode
                , base.timeInterval);

            if (sourceDatas == null || sourceDatas.Count == 0)
            {
                return;
            }

            //표시할 갯수를 맞춘다.
            RemoveSourceData(sourceDatas);

            string chartTitle = "양자::";

            if (OriginSourceType == OriginSourceTypeEnum.Normal)
            {
                chartTitle += "Orgin::";
            }
            if (OriginSourceType == OriginSourceTypeEnum.Whim)
            {
                sourceDatas = PPUtils.GetRecreateWhimDatas(itemCode, sourceDatas, true);
                chartTitle += "Whim::";
            }
            if (OriginSourceType == OriginSourceTypeEnum.Second)
            {
                sourceDatas = PPUtils.GetRecreateSecondDatas(itemCode, sourceDatas, 5, false);
                chartTitle += "Second::";
            }
            if (OriginSourceType == OriginSourceTypeEnum.SecondQutum)
            {
                sourceDatas = PPUtils.GetRecreateSecondDatas(itemCode, sourceDatas, 5, true);
                chart1.SetCandleColor(0, "Blue", "Red");
                chart2.SetCandleColor(0, "Blue", "Red");
                chart3.SetCandleColor(0, "Blue", "Red");
                chart4.SetCandleColor(0, "Blue", "Red");

                chartTitle += "SQutum::";
            }

            if (true || AverageType == AverageTypeEnum.Normal)
            {
                var averageDatas = PPUtils.GetAverageDatas(itemCode, sourceDatas, 5);
                sourceDatas = PPUtils.GetCutDatas(sourceDatas, averageDatas[0].DTime);
                chart1.LoadDataAndApply(itemCode, sourceDatas, averageDatas, base.timeInterval, 5);
                chart2.LoadDataAndApply(itemCode, averageDatas, averageDatas, base.timeInterval, 5);
                chart1.Title = chartTitle + "Normal";
                chart2.Title = chartTitle + "Normal";
            }
            if (true || AverageType == AverageTypeEnum.Balanced)
            {
                var averageDatas = PPUtils.GetBalancedAverageDatas(itemCode, sourceDatas, 4);
                sourceDatas = PPUtils.GetCutDatas(sourceDatas, averageDatas[0].DTime);
                chart3.LoadDataAndApply(itemCode, sourceDatas, averageDatas, base.timeInterval, 5);
                chart3.Title = chartTitle + "Balanced";
            }
            if (true || AverageType == AverageTypeEnum.Accumulated)
            {
                var averageDatas = PPUtils.GetAccumulatedAverageDatas(itemCode, sourceDatas, 9);
                sourceDatas = PPUtils.GetCutDatas(sourceDatas, averageDatas[0].DTime);
                chart4.LoadDataAndApply(itemCode, sourceDatas, averageDatas, base.timeInterval, 5);
                chart4.Title = chartTitle + "Accumulated";
            }
        }
Ejemplo n.º 3
0
        public override void loadData()
        {
            if (base.SelectedItemData == null)
            {
                return;
            }
            if (string.IsNullOrEmpty(base.SelectedItemData.Code))
            {
                return;
            }

            string itemCode = base.SelectedItemData.Code;

            var sourceDatas = PPContext.Instance.ClientContext.GetCandleSourceDataOrderByAsc(
                itemCode
                , base.timeInterval);

            if (sourceDatas == null || sourceDatas.Count == 0)
            {
                return;
            }

            //표시할 갯수를 맞춘다.
            RemoveSourceData(sourceDatas);
            //국내지수인 경우 시간갭이 크기 때문에.. 전일종가를 당일시가로 해야한다.

            var quantumDatas      = PPUtils.GetANodeDatas(sourceDatas);
            var plusQuantumDatas  = quantumDatas.plusList;
            var minusQuantumDatas = quantumDatas.minusList;

            //SetChangeOpenPrice(itemCode, plusQuantumDatas);
            //SetChangeOpenPrice(itemCode, minusQuantumDatas);

            string chartTitle = "ANode::";

            if (OriginSourceType == OriginSourceTypeEnum.Normal)
            {
                chartTitle += "Orgin::";
            }
            if (OriginSourceType == OriginSourceTypeEnum.Whim)
            {
                plusQuantumDatas  = PPUtils.GetRecreateWhimDatas(itemCode, plusQuantumDatas, true);
                minusQuantumDatas = PPUtils.GetRecreateWhimDatas(itemCode, minusQuantumDatas, true);
                chartTitle       += "Whim::";
            }
            if (OriginSourceType == OriginSourceTypeEnum.Second)
            {
                plusQuantumDatas  = PPUtils.GetRecreateSecondDatas(itemCode, plusQuantumDatas, 5, false);
                minusQuantumDatas = PPUtils.GetRecreateSecondDatas(itemCode, minusQuantumDatas, 5, false);
                chartTitle       += "Second::";
            }
            if (OriginSourceType == OriginSourceTypeEnum.SecondQutum)
            {
                plusQuantumDatas  = PPUtils.GetRecreateSecondDatas(itemCode, plusQuantumDatas, 5, true);
                minusQuantumDatas = PPUtils.GetRecreateSecondDatas(itemCode, minusQuantumDatas, 5, true);
                chartTitle       += "SQutum::";
            }

            if (true || AverageType == AverageTypeEnum.Normal)
            {
                var averageDatas  = PPUtils.GetAverageDatas(itemCode, sourceDatas, 5);
                var pAverageDatas = PPUtils.GetAverageDatas(itemCode, plusQuantumDatas, 5);
                var mAverageDatas = PPUtils.GetAverageDatas(itemCode, minusQuantumDatas, 5);

                sourceDatas = PPUtils.GetCutDatas(sourceDatas, pAverageDatas[0].DTime);
                chart1.LoadDataAndApply(itemCode, sourceDatas, pAverageDatas, mAverageDatas, base.timeInterval, 5);
                chart2.LoadDataAndApply(itemCode, averageDatas, pAverageDatas, mAverageDatas, base.timeInterval, 5);
                chart1.Title = chartTitle + "Normal";
                chart2.Title = chartTitle + "Normal";
            }
            if (true || AverageType == AverageTypeEnum.Balanced)
            {
                var averageDatas  = PPUtils.GetBalancedAverageDatas(itemCode, sourceDatas, 4);
                var pAverageDatas = PPUtils.GetBalancedAverageDatas(itemCode, plusQuantumDatas, 4);
                var mAverageDatas = PPUtils.GetBalancedAverageDatas(itemCode, minusQuantumDatas, 4);

                sourceDatas = PPUtils.GetCutDatas(sourceDatas, pAverageDatas[0].DTime);
                chart3.LoadDataAndApply(itemCode, sourceDatas, pAverageDatas, mAverageDatas, base.timeInterval, 5);
                chart3.Title = chartTitle + "Balanced";
            }
            if (true || AverageType == AverageTypeEnum.Accumulated)
            {
                var averageDatas  = PPUtils.GetAccumulatedAverageDatas(itemCode, sourceDatas, 9);
                var pAverageDatas = PPUtils.GetAccumulatedAverageDatas(itemCode, plusQuantumDatas, 9);
                var mAverageDatas = PPUtils.GetAccumulatedAverageDatas(itemCode, minusQuantumDatas, 9);

                sourceDatas = PPUtils.GetCutDatas(sourceDatas, pAverageDatas[0].DTime);
                chart4.LoadDataAndApply(itemCode, sourceDatas, pAverageDatas, mAverageDatas, base.timeInterval, 5);
                chart4.Title = chartTitle + "Accumulated";
            }
        }