Interesting, it does work inside the demo that way, but outside, it is not for me..what am I missing?
My suggestion for future was to add options for trading dates (like in the Chart -> Axis -> Scales section) just to compliment the financial portion of your package.
This does not plot the moving average line when the program is running, if you uncomment the Series1.FillSampleValues(100); and Series1.XValues.DateTime:=true; and comment out the rest of the code in the procedure it works as expected:
Code: Select all
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, TeEngine, Series, OHLChart, CandleCh, ExtCtrls, TeeProcs, Chart,
StatChar;
type
TForm1 = class(TForm)
Chart1: TChart;
Series1: TCandleSeries;
Series2: TLineSeries;
TeeFunction1: TMovingAverageFunction;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var tmpOpen : Double;
tmpClose : Double;
t : Integer;
tmpYear : Word;
tmpMonth : Word;
tmpDay : Word;
begin
// Series1.FillSampleValues(100);
// Series1.XValues.DateTime:=true;
Series1.XValues.DateTime:=False;
tmpOpen:=Random(1000);
Series1.Clear;
for t:=1 to 100 do
begin
tmpOpen :=tmpOpen+(Random(100)-50);
tmpClose:=tmpOpen-(Random(100)-50);
Series1.AddCandle( t, tmpOpen, tmpOpen+Random(10),
tmpClose-Random(10), tmpClose );
DecodeDate(Date+t, tmpYear, tmpMonth, tmpDay );
Series1.Labels[ Series1.Count-1 ]:= FormatFloat('0000',tmpYear)+
FormatFloat('00',tmpMonth)+
FormatFloat('00',tmpDay);
end;
end;