예제 #1
0
 public SecurityCharting(TTSFormState state)
     : base(state)
 {
     this.InitializeComponent();
     this.SetSecurityGrouping(System.Convert.ToInt32(this.GroupDropDown.Text));
     this.MainChart.Format(false);
     this.MainChart.AddChartArea("Main", true);
     this.MainChart.ChartAreas["Main"].AxisY.TitleFont = new System.Drawing.Font("Tahoma", 8.25f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 0);
     this.MainChart.AddSeries("HLOC", "Main", SeriesChartType.Candlestick);
     this.MainChart.Legends.Add("Main");
     this.MainChart.Legends["Main"].Enabled = false;
     this.MainChart.Legends.Add("Indicators");
     this.MainChart.Legends["Indicators"].LegendStyle = LegendStyle.Table;
     this.MainChart.Legends["Indicators"].InsideChartArea = "Main";
     this.MainChart.Legends["Indicators"].IsTextAutoFit = true;
     this.MainChart.Legends["Indicators"].Position.Auto = true;
     this.MainChart.Legends["Indicators"].BackColor = System.Drawing.Color.Transparent;
     this.MainChart.Legends["Indicators"].Docking = Docking.Top;
     this.MainChart.Legends["Indicators"].Alignment = System.Drawing.StringAlignment.Near;
     this.MainChart.Legends["Indicators"].Font = new System.Drawing.Font("Tahoma", 8.25f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0);
     this.MainChart.DataManipulator.IsStartFromFirst = true;
     this.MainChart.SuppressExceptions = true;
     this.MainChart.AddChartArea("RSI", true);
     this.MainChart.ChartAreas["RSI"].AlignWithChartArea = "Main";
     this.MainChart.ChartAreas["RSI"].AlignmentOrientation = AreaAlignmentOrientations.Vertical;
     this.MainChart.ChartAreas["RSI"].AlignmentStyle = AreaAlignmentStyles.All;
     this.MainChart.ChartAreas["RSI"].Visible = false;
     this.MainChart.ChartAreas["RSI"].AxisY.Title = "RSI";
     this.MainChart.ChartAreas["RSI"].AxisY.TitleFont = new System.Drawing.Font("Tahoma", 8.25f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 0);
     this.MainChart.ChartAreas["RSI"].AxisY.Maximum = 100.0;
     this.MainChart.ChartAreas["RSI"].AxisY.Minimum = 0.0;
     this.MainChart.ChartAreas["RSI"].AxisY.AddStripline(30.0);
     this.MainChart.ChartAreas["RSI"].AxisY.AddStripline(70.0);
     this.MainChart.AddChartArea("Volume", true);
     this.MainChart.ChartAreas["Volume"].AlignWithChartArea = "Main";
     this.MainChart.ChartAreas["Volume"].AlignmentOrientation = AreaAlignmentOrientations.Vertical;
     this.MainChart.ChartAreas["Volume"].AlignmentStyle = AreaAlignmentStyles.All;
     this.MainChart.ChartAreas["Volume"].Visible = false;
     this.MainChart.ChartAreas["Volume"].AxisY.Title = "Volume";
     this.MainChart.ChartAreas["Volume"].AxisY.TitleFont = new System.Drawing.Font("Tahoma", 8.25f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 0);
     this.MainChart.AddSeries("Volume", "Volume", SeriesChartType.Column);
     this.IsZoomableButton.PerformClick();
     base.Shown += delegate(object sender, System.EventArgs e)
     {
         this.ExpressionTextBox.TextBox.Focus();
     };
     base.AddResettingHandler(delegate
     {
         if (this.CurrentExpression != null)
         {
             this.LastExpression = this.CurrentExpression.OriginalExpressionString;
             this.CurrentExpression.Dispose();
         }
         else
         {
             this.LastExpression = null;
         }
         this.CurrentExpression = null;
     });
     base.AddResetHandler(delegate
     {
         this.BindTickerDropDown();
         this.BindPeriodDropDown();
         try
         {
             if (this.LastExpression != null)
             {
                 this.LoadExpression(this.LastExpression);
                 this.ExpressionTextBox.Text = this.LastExpression;
                 this.LastEnteredExpression = this.LastExpression;
             }
         }
         catch
         {
             this.ExpressionTextBox.Clear();
         }
     });
     this.BindTickerDropDown();
     this.BindPeriodDropDown();
     base.FormClosed += delegate(object sender, System.Windows.Forms.FormClosedEventArgs e)
     {
         if (this.CurrentExpression != null)
         {
             this.CurrentExpression.Dispose();
         }
     };
     if (state != null && state.State != null)
     {
         try
         {
             Tuple<int[], int[], int[]> tuple = (Tuple<int[], int[], int[]>)state.State;
             int[] item = tuple.Item1;
             for (int i = 0; i < item.Length; i++)
             {
                 int bars = item[i];
                 this.AddMovingAverage(bars);
             }
             int[] item2 = tuple.Item2;
             for (int j = 0; j < item2.Length; j++)
             {
                 int bars2 = item2[j];
                 this.AddRSI(bars2);
             }
             int[] item3 = tuple.Item3;
             for (int k = 0; k < item3.Length; k++)
             {
                 int bars3 = item3[k];
                 this.AddEMA(bars3);
             }
         }
         catch
         {
         }
     }
 }
예제 #2
0
 private void LoadExpression(string expression)
 {
     try
     {
         if (this.CurrentExpression != null)
         {
             this.CurrentExpression.Dispose();
         }
         foreach (Series current in this.MainChart.Series)
         {
             current.Points.Clear();
         }
         this.MainChart.Annotations.Clear();
         this.MainChart.ChartAreas["Main"].AxisX.ScaleView.ZoomReset(0);
         this.CurrentExpression = new ExpressionChartItem(expression, this.CurrentPeriod);
         this.DrawChart();
     }
     catch (System.Exception ex)
     {
         if (this.CurrentExpression != null)
         {
             this.CurrentExpression.Dispose();
         }
         this.CurrentExpression = null;
         throw ex;
     }
 }