Exemple #1
0
        //private const int UPDATE_EVERY_X_HOUR = 4;
        private void _updateSeries(PerformanceTick t)
        {
            ////only update graph each x hours
            //if (//!t.IsBalanceUpdated &&
            //  (t.Time.Minute != 0 || t.Time.Hour % UPDATE_EVERY_X_HOUR != 0)) return;

            _addPoint(PlotModelPer, 0, t.Time, t.Balance);
            _addPoint(PlotModelPer, 1, t.Time, t.Equity);
            _addPoint(PlotModelTick, 0, t.Time, t.Last);

            if (t.IsPosClosed)
            {
                bool isProfit = t.CurrentSignal * (t.Last - t.CurrentPosOpenRate) > 0;
                int  index    = isProfit ? 1 : 2;

                var hls = PlotModelTick.Series[index] as HighLowSeries;
                if (hls != null)
                {
                    var dp = new HighLowItem(
                        DateTimeAxis.ToDouble(t.CurrentPosOpenTime),
                        Math.Max(t.Last, t.CurrentPosOpenRate.Value),
                        Math.Min(t.Last, t.CurrentPosOpenRate.Value),
                        t.CurrentPosOpenRate.Value, t.Last);
                    hls.Items.Add(dp);
                }
            }
        }
        //private const int UPDATE_EVERY_X_HOUR = 4;
        private void _updateSeries(PerformanceTick t)
        {
            ////only update graph each x hours
              //if (//!t.IsBalanceUpdated &&
              //  (t.Time.Minute != 0 || t.Time.Hour % UPDATE_EVERY_X_HOUR != 0)) return;

              _addPoint(PlotModelPer, 0, t.Time, t.Balance);
              _addPoint(PlotModelPer, 1, t.Time, t.Equity);
              _addPoint(PlotModelTick, 0, t.Time, t.Last);

              if (t.IsPosClosed)
              {
            bool isProfit = t.CurrentSignal * (t.Last - t.CurrentPosOpenRate) > 0;
            int index = isProfit ? 1 : 2;

            var hls = PlotModelTick.Series[index] as HighLowSeries;
            if (hls != null)
            {
              var dp = new HighLowItem(
            DateTimeAxis.ToDouble(t.CurrentPosOpenTime),
            Math.Max(t.Last, t.CurrentPosOpenRate.Value),
            Math.Min(t.Last, t.CurrentPosOpenRate.Value),
            t.CurrentPosOpenRate.Value, t.Last);
              hls.Items.Add(dp);
            }
              }
        }