home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 25: Programming / pc_actual_25.iso / Delphi / TeeChartPro / TeeChart5Delphi5Eval.exe / %MAINDIR% / Examples / Features / Function_RSI.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2001-09-10  |  1.7 KB  |  71 lines

  1. unit Function_RSI;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   Base, StdCtrls, TeEngine, TeeTools, StatChar, Series, OHLChart, CandleCh,
  8.   ExtCtrls, TeeProcs, Chart, ComCtrls;
  9.  
  10. type
  11.   TRSIFunctionForm = class(TBaseForm)
  12.     Label1: TLabel;
  13.     Series1: TCandleSeries;
  14.     Chart2: TChart;
  15.     Series2: TLineSeries;
  16.     TeeFunction1: TRSIFunction;
  17.     ChartTool1: TColorLineTool;
  18.     ChartTool2: TColorLineTool;
  19.     ComboBox1: TComboBox;
  20.     Label2: TLabel;
  21.     Edit1: TEdit;
  22.     UpDown1: TUpDown;
  23.     procedure FormCreate(Sender: TObject);
  24.     procedure ComboBox1Change(Sender: TObject);
  25.     procedure Edit1Change(Sender: TObject);
  26.     procedure FormShow(Sender: TObject);
  27.   private
  28.     { Private declarations }
  29.   public
  30.     { Public declarations }
  31.   end;
  32.  
  33. implementation
  34.  
  35. {$R *.DFM}
  36.  
  37. procedure TRSIFunctionForm.FormCreate(Sender: TObject);
  38. begin
  39.   inherited;
  40.   Series1.FillSampleValues(50);
  41.  
  42.   { align the two charts on the left side... }
  43.   Chart1.LeftAxis.LabelsSize:=30;
  44.   Chart2.LeftAxis.LabelsSize:=30;
  45.  
  46.   { align the bottom axis... }
  47.   Chart2.BottomAxis.SetMinMax(Series1.XValues.MinValue,Series1.XValues.MaxValue);
  48. end;
  49.  
  50. procedure TRSIFunctionForm.ComboBox1Change(Sender: TObject);
  51. begin
  52.   if ComboBox1.ItemIndex=0 then TeeFunction1.Style:=rsiOpenClose
  53.                            else TeeFunction1.Style:=rsiClose;
  54. end;
  55.  
  56. procedure TRSIFunctionForm.Edit1Change(Sender: TObject);
  57. begin
  58.   { change the RSI "period" value (number of points) }
  59.   TeeFunction1.Period:=UpDown1.Position;
  60. end;
  61.  
  62. procedure TRSIFunctionForm.FormShow(Sender: TObject);
  63. begin
  64.   inherited;
  65.   ComboBox1.ItemIndex:=0;
  66. end;
  67.  
  68. initialization
  69.   RegisterClass(TRSIFunctionForm);
  70. end.
  71.