示例#1
0
		public void Create(DoubleSeries series)
		{
			this.indicator = Activator.CreateInstance(this.indicatorType) as Indicator;
			foreach (KeyValuePair<string, object> keyValuePair in this.properties)
				this.indicatorType.GetProperty(keyValuePair.Key).SetValue(this.indicator, keyValuePair.Value, (object[])null);
			this.indicator.Input = series;
		}
示例#2
0
 public Regression(DoubleSeries series1, DoubleSeries series2, double alpha, double beta)
 {
     this.graph             = new Graph();
     this.series1           = series1;
     this.series2           = series2;
     this.graph.LineEnabled = false;
     this.graph.MarkerSize  = 1;
 }
示例#3
0
		public Regression(DoubleSeries series1, DoubleSeries series2, double alpha, double beta)
		{
			this.graph = new Graph();
			this.series1 = series1;
			this.series2 = series2;
			this.graph.LineEnabled = false;
			this.graph.MarkerSize = 1;
		}
示例#4
0
		public SimpleSeriesItem(string name, DoubleSeries parentSeries):  base()
    {
      this.enabled = true;
      this.parentSeries = parentSeries;
      this.name = name;
      this.series = parentSeries;
      this.fillSeries = true;
    }
示例#5
0
		public List<IndicatorTemplateItem> GetIndicatorTemplates(DoubleSeries series)
		{
			List<IndicatorTemplateItem> list = new List<IndicatorTemplateItem>();
			this.Create(series);
			list.Add(this);
			foreach (IndicatorTemplateItem indicatorTemplateItem in this.children)
				list.AddRange((IEnumerable<IndicatorTemplateItem>)indicatorTemplateItem.GetIndicatorTemplates((DoubleSeries)this.indicator));
			return list;
		}
示例#6
0
		public void Create(DoubleSeries series)
		{
			this.table.Clear();
			foreach (IndicatorTemplateItem indicatorTemplateItem1 in this.indicatorTemplateList)
			{
				foreach (IndicatorTemplateItem indicatorTemplateItem2 in indicatorTemplateItem1.GetIndicatorTemplates(series))
					this.table[indicatorTemplateItem2.Indicator] = indicatorTemplateItem2;
			}
		}
示例#7
0
        public DoubleSeries GetOpenIntSeries()
        {
            DoubleSeries ds = new DoubleSeries(this.Name);

            for (int i = 0; i < this.Count; ++i)
            {
                ds.Add(this[i].DateTime, this[i].OpenInt);
            }
            return(ds);
        }
示例#8
0
        public DoubleSeries GetArray(int index1, int index2, BarData barData)
        {
            DoubleSeries ds = new DoubleSeries();

            for (int i = index1; i <= index2; ++i)
            {
                ds.Add(this.GetDateTime(i), this[i, barData]);
            }
            return(ds);
        }
示例#9
0
文件: DSView.cs 项目: heber/FreeOQ
		public DSView(Pad pad, DoubleSeries series, Color color, EIndexOption option, SmoothingMode smoothing)
			: base(pad)
		{
			this.mainSeries = series;
			this.option = option;
			this.KNRy1kSrcC = color;
			this.IXfyvDxxVL = smoothing;
			this.ToolTipFormat = "toool";
//			this.ToolTipFormat = this.toolTipFormat.Replace(FJDHryrxb1WIq5jBAt.mT707pbkgT(2828), pad.Chart.LabelDigitsCount.ToString());
		}
示例#10
0
        public DoubleSeries Pow(double Pow)
        {
            DoubleSeries ds = this.GetType().GetConstructor(new Type[0]).Invoke(new object[0]) as DoubleSeries;

            ds.fName  = this.fName;
            ds.fTitle = this.fTitle;
            for (int i = 0; i < this.Count; ++i)
            {
                ds.Add(this.GetDateTime(i), Math.Pow(this[i, 0], Pow));
            }
            return(ds);
        }
示例#11
0
        public virtual DoubleSeries GetNegativeSeries()
        {
            DoubleSeries ds = new DoubleSeries();

            for (int i = 0; i < this.Count; ++i)
            {
                if (this[i] < 0.0)
                {
                    ds.Add(this.GetDateTime(i), this[i]);
                }
            }
            return(ds);
        }
示例#12
0
        public DoubleSeries GetCloseSeries(DateTime date1, DateTime date2)
        {
            DoubleSeries ds = new DoubleSeries(this.Name);

            for (int i = 0; i < this.Count; ++i)
            {
                if (this[i].DateTime >= date1 && this[i].DateTime <= date2)
                {
                    ds.Add(this[i].DateTime, this[i].Close);
                }
            }
            return(ds);
        }
示例#13
0
        public DoubleSeries GetOpenIntSeries(DateTime date1, DateTime date2)
        {
            DoubleSeries doubleSeries = new DoubleSeries(this.Name);

            for (int index = 0; index < this.Count; ++index)
            {
                if (this[index].DateTime >= date1 && this[index].DateTime <= date2)
                {
                    doubleSeries.Add(this[index].DateTime, (double)this[index].OpenInt);
                }
            }
            return(doubleSeries);
        }
示例#14
0
 protected override void OnUpdateChart(ICollection<IDataObject> objects)
 {
   DoubleSeries doubleSeries = new DoubleSeries("Trade");
   using (IEnumerator<IDataObject> enumerator = ((IEnumerable<IDataObject>) objects).GetEnumerator())
   {
     while (((IEnumerator) enumerator).MoveNext())
     {
       Trade trade = (Trade) enumerator.Current;
       doubleSeries.Add(trade.DateTime, trade.Price);
     }
   }
   ((TimeSeries) doubleSeries).Draw(Color.Black);
 }
示例#15
0
        public static DoubleSeries operator *(double val, DoubleSeries series)
        {
            if (series == null)
            {
                throw new ArgumentException("series == null");
            }
            DoubleSeries ds = new DoubleSeries("series1.Name" + series.Name);

            for (int i = 0; i < series.Count; ++i)
            {
                ds.Add(series.GetDateTime(i), val * series[i, 0]);
            }
            return(ds);
        }
示例#16
0
    protected override void OnUpdateChart(ICollection<IDataObject> objects)
    {
      DoubleSeries doubleSeries1 = new DoubleSeries("Bid");
      DoubleSeries doubleSeries2 = new DoubleSeries("Ask");
      using (IEnumerator<IDataObject> enumerator = ((IEnumerable<IDataObject>) objects).GetEnumerator())
      {
        while (((IEnumerator) enumerator).MoveNext())
        {
          Quote quote = (Quote) enumerator.Current;
          doubleSeries1.Add(quote.DateTime, quote.Bid);
					doubleSeries2.Add(quote.DateTime, quote.Ask);
        }
      }
      ((TimeSeries) doubleSeries1).Draw(Color.Blue);
      ((TimeSeries) doubleSeries2).Draw(Color.Red);
    }
示例#17
0
 public DoubleSeries GetResidualSeries()
 {
     Calculate();
     this.rYJrndpjL       = new DoubleSeries();
     this.rYJrndpjL.Title = this.series1.Name + "" + this.series2.Name + "name";
     for (int index = 0; index < this.series1.Count; ++index)
     {
         DateTime dateTime = this.series1.GetDateTime(index);
         if (this.series2.Contains(dateTime))
         {
             double X          = this.series1[dateTime];
             double num        = this.series2[dateTime];
             double regression = this.GetRegression(X);
             this.rYJrndpjL.Add(dateTime, num - regression);
         }
     }
     return(this.rYJrndpjL);
 }
示例#18
0
        public static DoubleSeries operator /(DoubleSeries series1, DoubleSeries series2)
        {
            if (series1 == null || series2 == null)
            {
                throw new ArgumentException("series1 = null || series2 == null");
            }
            DoubleSeries ds = new DoubleSeries("series1.Name" + series1.Name + "series2.Name" + series2.Name);

            for (int i = 0; i < series1.Count; ++i)
            {
                DateTime dt = series1.GetDateTime(i);
                if (series2.Contains(dt) && series2[dt] != 0.0)
                {
                    ds.Add(dt, series1[dt, EIndexOption.Null] / series2[dt, EIndexOption.Null]);
                }
            }
            return(ds);
        }
示例#19
0
		public DoubleSeries GetResidualSeries()
		{
			Calculate();
			this.rYJrndpjL = new DoubleSeries();
			this.rYJrndpjL.Title = this.series1.Name + "" + this.series2.Name + "name";
			for (int index = 0; index < this.series1.Count; ++index)
			{
				DateTime dateTime = this.series1.GetDateTime(index);
				if (this.series2.Contains(dateTime))
				{
					double X = this.series1[dateTime];
					double num = this.series2[dateTime];
					double regression = this.GetRegression(X);
					this.rYJrndpjL.Add(dateTime, num - regression);
				}
			}
			return this.rYJrndpjL;
		}
示例#20
0
        public new DoubleSeries Shift(int offset)
        {
            DoubleSeries ds  = new DoubleSeries(base.Name, base.Title);
            int          num = 0;

            if (offset < 0)
            {
                num += Math.Abs(offset);
            }

            for (int i = num; i < this.Count; i++)
            {
                int num2 = i + offset;
                if (num2 >= this.Count)
                {
                    break;
                }
                DateTime dateTime = this.GetDateTime(num2);
                double   value    = this[i];
                ds[dateTime] = value;
            }
            return(ds);
        }
示例#21
0
        public virtual DoubleSeries GetPercentReturnSeries()
        {
            DoubleSeries ds = new DoubleSeries(this.fName, this.fTitle);

            if (this.Count > 1)
            {
                double t0 = this[0];
                for (int i = 0; i < this.Count; ++i)
                {
                    DateTime dt = this.GetDateTime(i);
                    double   t1 = this[i];
                    if (t0 != 0.0)
                    {
                        ds.Add(dt, (t1 / t0 - 1.0) * 100.0);
                    }
                    else
                    {
                        ds.Add(dt, 0.0);
                    }
                    t0 = t1;
                }
            }
            return(ds);
        }
示例#22
0
 public AddIndicatorForm(System.Type indicatorType, int padCount, DoubleSeries series, List<Indicator> indicatorList, int selectedPad, Color color)
 {
     this.InitializeComponent();
     this.padNumber = padCount;
     this.sq_indicator = Activator.CreateInstance(indicatorType) as Indicator;
     this.indicator = Activator.CreateInstance(System.Type.GetType("OpenQuant.API.Indicators." + indicatorType.Name + ", OpenQuant.API"), true) as Indicator;
     this.sq_indicator = this.indicator.GetType().GetField("indicator", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetField).GetValue((object)this.indicator) as Indicator;
     this.txtName.Text = ((TimeSeries)this.sq_indicator).Name;
     ((TimeSeries)this.sq_indicator).Color = color;
     this.propertyGrid1.SelectedObject = (object)this.indicator;
     for (int index = 0; index < this.padNumber; ++index)
         this.cbxPads.Items.Add((object)index);
     this.cbxSeries.Items.Add((object)new SeriesItem(series));
     using (List<Indicator>.Enumerator enumerator = indicatorList.GetEnumerator())
     {
         while (enumerator.MoveNext())
             this.cbxSeries.Items.Add((object)new SeriesItem((DoubleSeries)enumerator.Current));
     }
     this.cbxPads.SelectedIndex = selectedPad;
     this.cbxSeries.SelectedIndex = 0;
     if (selectedPad != -1 && this.sq_indicator.Type == EIndicatorType.Price)
         return;
     this.cbxNewPad.Checked = true;
 }
示例#23
0
文件: DSView.cs 项目: heber/FreeOQ
		public DSView(Pad pad, DoubleSeries series, EIndexOption option) 
			: this(pad, series, Color.White, option, SmoothingMode.AntiAlias)
		{
		}
示例#24
0
文件: PnFSeries.cs 项目: heber/FreeOQ
		public DoubleSeries GetCloseSeries(DateTime date1, DateTime date2)
		{
			DoubleSeries ds = new DoubleSeries(this.Name);
			for (int i = 0; i < this.Count; ++i)
			{
				if (this[i].DateTime >= date1 && this[i].DateTime <= date2)
					ds.Add(this[i].DateTime, this[i].Close);
			}
			return ds;
		}
示例#25
0
文件: PnFSeries.cs 项目: heber/FreeOQ
		public DoubleSeries GetOpenIntSeries(DateTime date1, DateTime date2)
		{
			DoubleSeries doubleSeries = new DoubleSeries(this.Name);
			for (int index = 0; index < this.Count; ++index)
			{
				if (this[index].DateTime >= date1 && this[index].DateTime <= date2)
					doubleSeries.Add(this[index].DateTime, (double)this[index].OpenInt);
			}
			return doubleSeries;
		}
示例#26
0
文件: PnFSeries.cs 项目: heber/FreeOQ
		public DoubleSeries GetArray(int index1, int index2, BarData barData)
		{
			DoubleSeries ds = new DoubleSeries();
			for (int i = index1; i <= index2; ++i)
				ds.Add(this.GetDateTime(i), this[i, barData]);
			return ds;
		}
示例#27
0
文件: PnFSeries.cs 项目: heber/FreeOQ
		public DoubleSeries GetOpenIntSeries()
		{
			DoubleSeries ds = new DoubleSeries(this.Name);
			for (int i = 0; i < this.Count; ++i)
				ds.Add(this[i].DateTime, this[i].OpenInt);
			return ds;
		}
示例#28
0
文件: MACD.cs 项目: heber/FreeOQ
 public static double Value(DoubleSeries input, int index, int length1, int length2)
 {
   return MACD.Value((TimeSeries) input, index, length1, length2, BarData.Close);
 }
示例#29
0
文件: DSView.cs 项目: heber/FreeOQ
		public DSView(Pad pad, DoubleSeries series, Color color) : this(pad, series, color, EIndexOption.Null, SmoothingMode.AntiAlias)
		{
		}
示例#30
0
 public Performance(Portfolio portfolio)
 {
     this.enabled = true;
     this.equitySeries = new DoubleSeries("Equity");
     this.coreEquitySeries = new DoubleSeries("CoreEquity");
     this.pnlSeries = new DoubleSeries("PnL");
     this.drawdownSeries = new DoubleSeries("Drawdown");
     this.drawdownPercentSeries = new DoubleSeries("DrawdownPercent");
     this.InjBy1lkoo = double.NaN;
     this.MrYBqYV87G = double.NaN;
     this.portfolio = portfolio;
     this.CalculatePnL = true;
     this.CalculateDrawdown = true;
     this.portfolio.ValueChanged += new PositionEventHandler(this.RLrBXT2waX);
 }
示例#31
0
文件: Chart.cs 项目: heber/FreeOQ
		public void DrawSeries(DoubleSeries series, int padNumber, Color color, SimpleDSStyle style, SmoothingMode smoothingMode)
		{
			this.DrawSeries(series, padNumber, color, style, EIndexOption.Null, smoothingMode);
		}
示例#32
0
文件: Chart.cs 项目: heber/FreeOQ
		public Chart(DoubleSeries mainSeries) : this()
		{
			this.SetMainSeries(mainSeries);
		}
示例#33
0
 internal TimeSeries(DoubleSeries series)
 {
     this.series = series;
 }
示例#34
0
		internal TimeSeries(DoubleSeries series)
		{
			this.series = series;
		}
示例#35
0
文件: Chart.cs 项目: heber/FreeOQ
		public void SetMainSeries(DoubleSeries mainSeries, bool showVolumePad = false)
		{
			lock (this.dataLock)
			{
				if (this.mainSeries != null)
				{
					this.series.ItemAdded -= new ItemAddedEventHandler(this.HandleSeriesItemAdded);
					this.series.Cleared -= new EventHandler(this.HandleSeriesCleared);
				}
				this.series = mainSeries;
				if (mainSeries is BarSeries)
				{
					this.SetBSView(this.barSeriesStyle, true);
				}
				else
				{
					this.mainSeries = this.series;
					this.mainSeriesView = (SeriesView)new DSView(this.pads[0], mainSeries, mainSeries.Color, EIndexOption.Null, SmoothingMode.HighSpeed);
					this.pads[0].AddPrimitive(this.mainSeriesView);
				}
				this.series.ItemAdded += new ItemAddedEventHandler(this.HandleSeriesItemAdded);
				this.series.Cleared += new EventHandler(this.HandleSeriesCleared);
				this.pads[0].ScaleStyle = this.scaleStyle;
				if (showVolumePad)
					this.ShowVolumePad();
				this.firstIndex = this.updateStyle != ChartUpdateStyle.WholeRange ? Math.Max(0, mainSeries.Count - this.minCountOfBars) : 0;
				this.lastIndex = mainSeries.Count - 1;
				if (mainSeries.Count == 0)
					this.firstIndex = -1;
				if (this.lastIndex >= 0)
					this.SetPadIntervals(this.firstIndex, this.lastIndex);
				this.contentUpdated = true;
				this.Invalidate();
			}
		}
示例#36
0
 ///<summary>
 ///  Creates an instance of TimeSeries class
 ///</summary>
 public TimeSeries(string name, string title)
 {
     this.series = new DoubleSeries(name, title);
 }
示例#37
0
文件: Chart.cs 项目: heber/FreeOQ
		public void DrawSeries(DoubleSeries series, int padNumber, Color color)
		{
			this.DrawSeries(series, padNumber, color, EIndexOption.Null);
		}
示例#38
0
 protected void Init(string name, SeriesTesterItem parentSeriesItem, string title, bool fillSeries)
 {
   this.isUpdating = false;
   this.lastDateTime = DateTime.MinValue;
   this.series = new DoubleSeries();
   this.series.Name = name;
   this.series.Title = title;
   this.parentComponent = parentSeriesItem;
   this.parentSeries = parentSeriesItem.Series;
   if (this.parentSeries != null)
     this.parentSeries.ItemAdded += new ItemAddedEventHandler(this.syrQYCdiq);
   this.FillSeries = fillSeries;
 }
示例#39
0
文件: Chart.cs 项目: heber/FreeOQ
		public void DrawSeries(DoubleSeries series, int padNumber, Color color, SimpleDSStyle style, EIndexOption option, SmoothingMode smoothingMode)
		{
			lock(this.dataLock)
			{
				if (!this.volumePadShown && padNumber > 1)
					--padNumber;
				DSView view = new DSView(this.pads[padNumber], series, color, option, smoothingMode);
				view.Style = style;
				this.pads[padNumber].AddPrimitive(view);
				view.SetInterval(this.leftDateTime, this.rightDateTime);
				this.contentUpdated = true;
			}
		}
示例#40
0
文件: RSI.cs 项目: heber/FreeOQ
    protected override void Init()
    {
			this.Name = "RSI"+ this.fLength.ToString();
			this.Title = "RSI";
      this.Clear();
      this.fCalculate = true;
      if (this.fInput == null)
        return;
      if (this.fInput is BarSeries)
				this.Name = "RSI" + (object) this.fLength + (string) (object) this.fOption;
			if (TimeSeries.fNameOption == ENameOption.Long)
        this.Name = this.fInput.Name + this.Name;
      this.fUp = new DoubleSeries();
      this.fDown = new DoubleSeries();
    }
示例#41
0
		///<summary>
		///  Creates an instance of TimeSeries class 
		///</summary>
		public TimeSeries(string name, string title)
		{
			this.series = new DoubleSeries(name, title);
		}
示例#42
0
文件: RSI.cs 项目: heber/FreeOQ
 public static double Value(DoubleSeries input, int index, int length, EIndicatorStyle style)
 {
   return RSI.Value((TimeSeries) input, index, length, BarData.Close, style);
 }
示例#43
0
文件: BBU.cs 项目: heber/FreeOQ
 public static double Value(DoubleSeries input, int index, int length, double k)
 {
   return BBU.Value((TimeSeries) input, index, length, k, BarData.Close);
 }
示例#44
0
文件: PDI.cs 项目: heber/FreeOQ
    protected override void Init()
    {
			this.Name = "PDI" + (object) this.fLength;
			this.Title =  "PDI";
      this.Clear();
      this.fCalculate = true;
      if (this.fInput == null)
        return;
			if (TimeSeries.fNameOption == ENameOption.Long)
        this.Name = this.fInput.Name + this.Name;
      this.fPDM = new DoubleSeries();
      this.fTR = new DoubleSeries();
    }