コード例 #1
0
        public void ChangeCurrentBar(ITimeLineBar chart, int barPos)
        {
            this.BarPos = barPos;
            ReadOnlyList_TmpValue <double> timelist      = (ReadOnlyList_TmpValue <double>)Arr_Time;
            ReadOnlyList_TmpValue <float>  pricelist     = (ReadOnlyList_TmpValue <float>)Arr_Price;
            ReadOnlyList_TmpValue <int>    mountlist     = (ReadOnlyList_TmpValue <int>)Arr_Mount;
            ReadOnlyList_TmpValue <int>    holdlist      = (ReadOnlyList_TmpValue <int>)Arr_Hold;
            ReadOnlyList_TmpValue <float>  upPercentlist = (ReadOnlyList_TmpValue <float>)Arr_UpPercent;
            ReadOnlyList_TmpValue <float>  upRangelist   = (ReadOnlyList_TmpValue <float>)Arr_UpRange;

            if (chart == null)
            {
                timelist.ClearTmpValue();
                pricelist.ClearTmpValue();
                mountlist.ClearTmpValue();
                holdlist.ClearTmpValue();
                upPercentlist.ClearTmpValue();
                upRangelist.ClearTmpValue();
            }
            else
            {
                timelist.SetTmpValue(barPos, chart.Time);
                pricelist.SetTmpValue(barPos, chart.Price);
                mountlist.SetTmpValue(barPos, chart.Mount);
                holdlist.SetTmpValue(barPos, chart.Hold);
                upPercentlist.SetTmpValue(barPos, chart.UpPercent);
                upRangelist.SetTmpValue(barPos, chart.UpRange);
            }
        }
コード例 #2
0
ファイル: DataForwardUtils_Tick.cs プロジェクト: wanwei/sc2
        private static void ForwardNextDay_TimeLine(DataForForward_Code forwardData)
        {
            if (!forwardData.UseTimeLineData)
            {
                return;
            }

            ITimeLineBar timeLineBar = GetTimeLineBar(forwardData.CurrentTickData, forwardData.CurrentTimeLineData.YesterdayEnd);

            forwardData.CurrentTimeLineData.ChangeCurrentBar(timeLineBar);
        }
コード例 #3
0
ファイル: TimeLineUtils.cs プロジェクト: wanwei/sc2
        public static TimeLineBar GetTimeLineBar(ITimeLineBar timelineBar, ITickBar tickBar, float lastEndPrice)
        {
            TimeLineBar bar = new TimeLineBar();

            bar.Code      = tickBar.Code;
            bar.Time      = tickBar.Time;
            bar.Price     = tickBar.Price;
            bar.Hold      = tickBar.Hold;
            bar.Mount     = timelineBar.Mount + tickBar.Mount;
            bar.UpRange   = tickBar.Price - lastEndPrice;
            bar.UpPercent = (float)NumberUtils.percent(tickBar.Price, lastEndPrice);
            return(bar);
        }
コード例 #4
0
ファイル: CurrentInfoComponent.cs プロジェクト: wanwei/sc2
        private CurrentInfo GetCurrentInfo(ITickData tick)
        {
            CurrentInfo chartinfo = new CurrentInfo();

            chartinfo.code = this.chartComponentController.ChartComponentData.Code;
            if (tick == null)
            {
                return(chartinfo);
            }
            //ITickData tick = null;
            //CurrentInfo chartinfo = new CurrentInfo();
            ////ITickData tick = navigate.CurrentTickData;
            ITickBar tickBar = tick.GetCurrentBar();

            //////List<RealDataInfo> reals = currentInfo.GetReal();
            //////List<ChartInfo> charts = currentInfo.GetChart(ChartPeriod.DAY, 1);
            ////ITickBar tickChart = tick.GetBar(navigate.CurrentTickIndex);
            chartinfo.currentPrice = Math.Round(tick.Price, 2);
            chartinfo.currentHand  = tickBar.Mount;
            chartinfo.totalHand    = tickBar.TotalMount;
            chartinfo.totalHold    = tickBar.Hold;
            chartinfo.dailyAdd     = 0;
            chartinfo.outMount     = 0;
            chartinfo.outPercent   = 0.5;
            chartinfo.inMount      = 0;
            chartinfo.inPercent    = 0.5;

            //////RealDataInfo r = reals[reals.Count - 1];
            //////ChartInfo chart = charts[0];
            ITimeLineData realData = chartComponentController.CurrentRealTimeDataReader_Code.GetTimeLineData();

            if (realData != null)
            {
                ITimeLineBar realChart = realData.GetCurrentBar();
                chartinfo.upRange   = Math.Round(realChart.UpRange, 2);
                chartinfo.upPercent = realChart.UpPercent;
                chartinfo.upSpeed   = 0;
            }
            //chartinfo.open = realData.StartPrice;
            //chartinfo.high = chart.HighPrice;
            //chartinfo.low = chart.LowPrice;
            ////chartinfo.jsPrice = 0;
            ////chartinfo.lastJsPrice = Math.Round(r.LastJs, 2);
            ////double maxUprange = (int)(r.LastJs * 0.04);
            ////chartinfo.maxUp = r.LastJs + maxUprange;
            ////chartinfo.maxDown = r.LastJs - maxUprange;
            ////return chartinfo;
            //return chartinfo;
            return(chartinfo);
        }
コード例 #5
0
ファイル: TimeLineUtils.cs プロジェクト: wanwei/sc2
        public static TimeLineBar GetTimeLineBar(ITimeLineBar timeLineBar, ITickData tickData, int startIndex, int endIndex, float lastEndPrice)
        {
            TimeLineBar bar = new TimeLineBar();

            bar.Code = tickData.Code;

            ITickBar endTickBar = tickData.GetBar(endIndex);

            bar.Time      = endTickBar.Time;
            bar.Price     = endTickBar.Price;
            bar.Hold      = endTickBar.Hold;
            bar.UpRange   = endTickBar.Price - lastEndPrice;
            bar.UpPercent = (float)NumberUtils.percent(endTickBar.Price, lastEndPrice);

            int mount = timeLineBar.Mount;

            for (int i = startIndex; i <= endIndex; i++)
            {
                mount += tickData.Arr_Mount[i];
            }
            bar.Mount = mount;
            bar.Hold  = endTickBar.Hold;
            return(bar);
        }
コード例 #6
0
 /// <summary>
 /// 修改当前chart,
 /// </summary>
 /// <param name="chart"></param>
 public void ChangeCurrentBar(ITimeLineBar chart)
 {
     ChangeCurrentBar(chart, BarPos);
 }
コード例 #7
0
ファイル: DataForwardUtils_Tick.cs プロジェクト: wanwei/sc2
 private static TimeLineBar GetTimeLineBar(ITimeLineBar klineBar, ITickBar tickBar, float lastEndPricce)
 {
     return(TimeLineUtils.GetTimeLineBar(klineBar, tickBar, lastEndPricce));
 }