Программирование - это просто
Advertisement
arrow arrow , , arrow TPASSMomentum (Delphi 7: , create, private, protected, breakpoint)
08.02.2023 .
1:
C#
Delphi
Web-
Excel-
.
TPASSMomentum (Delphi 7: , create, private, protected, breakpoint) E-mail
megabax   
10.08.2009 .
New Page 1

TPASSMomentum (Delphi 7: , create, private, protected, breakpoint, )

.

. . mmMenu : ""-->"" (itLoad). : odOpenDialog, lbDateTime lbResult, "" (btnCalk), SpinEdit (seCandle seDT), Samples. *:

Delphi 7: , create, private, protected, momentum,

( *.txt)

FPriceSource FIndicator ( ):

  TfrmMomentum = class(TForm)
    odOpenDialog: TOpenDialog;
    mmMenu: TMainMenu;
    itFile: TMenuItem;
    itLoad: TMenuItem;
    lbResult: TLabel;
    btnCalk: TButton;
    seDT: TSpinEdit;
    lbDateTime: TLabel;
    seCandle: TSpinEdit;
    procedure itLoadClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure btnCalkClick(Sender: TObject);
    procedure seCandleChange(Sender: TObject);
  private
    { Private declarations }
    FPriceSource:TPASSPriceSource;
    FIndicator:TPASSMomentum;
  public
    { Public declarations }
  end;

OnCreate  FPriceSource FIndicator nil:

procedure TfrmMomentum.FormCreate(Sender: TObject);
begin
   FPriceSource:=nil;
   FIndicator:=nil;
end;

OnClick "":

procedure TfrmMomentum.itLoadClick(Sender: TObject);
begin
   if odOpenDialog.Execute then
   begin
      if FPriceSource<>nil then FreeAndNil(FPriceSource);
      FPriceSource:=TPASSPriceSource.Create('',false);
      FPriceSource.LoadDataFromTextFile(odOpenDialog.FileName);
   end;
end;

, , , FPriceSource, , . , , OnChange seCandle:

procedure TfrmMomentum.seCandleChange(Sender: TObject);
begin
  FPriceSource.CurrentItemIndex:=seCandle.Value;
  lbDateTime.Caption:= DateTimeToStr(FPriceSource.GetDataByFieldName('DateTime'));
end;    

, , ""

procedure TfrmMomentum.btnCalkClick(Sender: TObject);
begin
  if FIndicator<>nil then FreeAndNil(FIndicator);
  FIndicator:=TPASSMomentum.Create(seDT.Value,'Close');
  FIndicator.PriceSource:=FPriceSource;
  lbResult.Caption:= intToStr(FIndicator.GetParameterByName('Value'));
end;

, . FPriceSource, .

, . "".

! *.

Delphi 7: , create, private, protected, momentum,

 FParameters.Add('PriceFieldType',APriceFieldType)*;
 

Delphi 7: , create, private, protected, momentum,

, FParameters . , , *:

Delphi 7: , create, private, protected,

( ), F5, ( ) "Debu" --> "Toggle breakpoint"*.

    Delphi

. "" . , "Watches" "View" --> "Debug Windows" --> "Watches"*:

Delphi 7: , create, private, protected, momentum,

FParameters, Insert. *:

Delphi 7: , create, private, protected, momentum,

FParameters nil*:

Delphi 7: , create, private, protected, momentum,

, , :

inherited Create;

,

 inherited Create;
 

, , F7 . TPASSIndicator, :

inherited Create

FParameters:=TPASSParameters.Create

, FParameters . , TPASSMomentum nil.

, Delphi. , , , . , . TPASSIndicator FParameters  private, TPASSMomentum protected. . !

PASSIndicators (, ), FParameters  . , , private, protected. , :

  • , , private protected, , . PASSIndicators:

  TPASSIndicator=Class(TPASSAbstractDataSource)
  private
    FParameters:TPASSParameters; //   .
    FPriceSource:TPASSPriceSource; //  .
    procedure SetPriceSource(APriceSource:TPassPriceSource);
    procedure UpdateParameters; virtual; abstract;
  public
    constructor Create;
    property PriceSource:TPASSPriceSource read FPriceSource write SetPriceSource;
    procedure SetParameterByName(AParameterName:string; AParameterValue:Variant); virtual;
    function GetParameterByName(AParameterName:string):Variant; virtual;
    function GetResultByFieldName(AFieldName:string):double;  virtual; abstract;
    function GetResultByFieldNameAndIndex(FieldName:string; Index:LongInt):double;  virtual; abstract;
    function GetResultByFieldNum(AFieldName:integer):double; virtual; abstract;
    function GetResultByFieldNumAndIndex(FieldName:Integer; Index:LongInt):double; virtual; abstract;
    procedure First; virtual; abstract;
    procedure Last; virtual; abstract;
    function Next:boolean; virtual; abstract;
    function Prev:boolean; virtual; abstract;
    function GetIndicatorName:string; virtual; abstract;
    Destructor Destroy; virtual;
  end;
  • , , ( ), protected. private.

, TPASSIndicator protected. . PASSIndicators, .

 


, * ,   . 1274 "Delphi", "Borland Software Corporation".

 

( 27.07.2013 . )
 
« .   . »
 
© 2023 Программирование - это просто
Joomla! - , GNU/GPL.
© 2005-2008 Joom.Ru - Joomla!
Design by Mamboteam.com | Powered by Mambobanner.de
  .