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

  1. unit RSI_Function;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   Base, TeEngine, StatChar, Series, OHLChart, CandleCh, ExtCtrls, TeeProcs,
  8.   Chart, StdCtrls, ComCtrls;
  9.  
  10. type
  11.   TRSICalcForm = class(TBaseForm)
  12.     Series1: TCandleSeries;
  13.     Series2: TLineSeries;
  14.     TeeFunction1: TRSIFunction;
  15.     ComboBox1: TComboBox;
  16.     Label1: TLabel;
  17.     Label2: TLabel;
  18.     Edit1: TEdit;
  19.     UpDown1: TUpDown;
  20.     procedure ComboBox1Change(Sender: TObject);
  21.     procedure Edit1Change(Sender: TObject);
  22.     procedure FormCreate(Sender: TObject);
  23.     procedure Chart1AllowScroll(Sender: TChartAxis; var AMin, AMax: Double;
  24.       var AllowScroll: Boolean);
  25.     procedure FormShow(Sender: TObject);
  26.   private
  27.     { Private declarations }
  28.   public
  29.     { Public declarations }
  30.   end;
  31.  
  32. var
  33.   RSICalcForm: TRSICalcForm;
  34.  
  35. implementation
  36.  
  37. {$R *.DFM}
  38.  
  39. procedure TRSICalcForm.ComboBox1Change(Sender: TObject);
  40. begin
  41.   if ComboBox1.ItemIndex=0 then TeeFunction1.Style:=rsiOpenClose
  42.                            else TeeFunction1.Style:=rsiClose;
  43. end;
  44.  
  45. procedure TRSICalcForm.Edit1Change(Sender: TObject);
  46. begin
  47.   TeeFunction1.Period:=UpDown1.Position;
  48. end;
  49.  
  50. procedure TRSICalcForm.FormCreate(Sender: TObject);
  51. begin
  52.   inherited;
  53.   Series1.FillSampleValues(100);
  54.  
  55.   TeeFunction1.Period:=10;  { take 10 prices }
  56.   TeeFunction1.Style:=rsiOpenClose;  { default calc method }
  57. end;
  58.  
  59. procedure TRSICalcForm.Chart1AllowScroll(Sender: TChartAxis; var AMin,
  60.   AMax: Double; var AllowScroll: Boolean);
  61. begin
  62.   AllowScroll:=Sender<>Chart1.CustomAxes[0]
  63. end;
  64.  
  65. procedure TRSICalcForm.FormShow(Sender: TObject);
  66. begin
  67.   inherited;
  68.   ComboBox1.ItemIndex:=0;
  69. end;
  70.  
  71. initialization
  72.   RegisterClass(TRSICalcForm);
  73. end.
  74.