Exemplo n.º 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;
		}
Exemplo n.º 2
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;
 }
Exemplo n.º 3
0
		private IndicatorTemplateItem CreateIndicatorTemplate(Indicator indicator)
		{
			Type type = ((object)indicator).GetType();
			IndicatorTemplateItem indicatorTemplateItem = new IndicatorTemplateItem(type);
			indicatorTemplateItem.SetProperty("Color", ((TimeSeries)indicator).Color);
			indicatorTemplateItem.SetProperty("Name", ((TimeSeries)indicator).Name);
			indicatorTemplateItem.SetProperty("Title", ((TimeSeries)indicator).Title);
			foreach (PropertyInfo propertyInfo in type.GetProperties())
			{
				foreach (Attribute attribute in propertyInfo.GetCustomAttributes(false))
				{
					if (attribute.GetType() == typeof(IndicatorParameterAttribute))
						indicatorTemplateItem.SetProperty(propertyInfo.Name, propertyInfo.GetValue((object)indicator, (object[])null));
				}
			}
			return indicatorTemplateItem;
		}
Exemplo n.º 4
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;
 }
Exemplo n.º 5
0
		public IndicatorTemplateItem(Indicator indicator, Type indicatorType)
      : this(indicatorType)
		{
			this.indicator = indicator;
		}
Exemplo n.º 6
0
		public void RemoveIndicator(Indicator indicator)
		{
			this.RemoveIndicatorTemplate(this.table[indicator]);
		}
Exemplo n.º 7
0
		public void AddIndicator(Indicator indicator, Indicator inputIndicator)
		{
			IndicatorTemplateItem indicatorTemplate = this.CreateIndicatorTemplate(indicator);
			this.table[inputIndicator].AddChild(indicatorTemplate);
			this.table[indicator] = indicatorTemplate;
		}
Exemplo n.º 8
0
		public void AddIndicator(Indicator indicator)
		{
			IndicatorTemplateItem indicatorTemplate = this.CreateIndicatorTemplate(indicator);
			this.indicatorTemplateList.Add(indicatorTemplate);
			this.table[indicator] = indicatorTemplate;
		}
Exemplo n.º 9
0
 public void AddRemove(int pad, Indicator indicator)
 {
   this.padTemplates[pad].RemoveIndicator(indicator);
 }
Exemplo n.º 10
0
 public void AddIndicator(int pad, Indicator indicator, Indicator inputIndicator)
 {
   if (!this.padTemplates.ContainsKey(pad))
     this.padTemplates[pad] = new PadTemplate();
   this.padTemplates[pad].AddIndicator(indicator, inputIndicator);
 }