Page 1 of 1

Function Series under Program Control

Posted: Wed Apr 27, 2005 12:39 pm
by 9236155
I am trying to generate a function series under program control, program stub given below:-

Chart1.AddSeries(TLineSeries);
lastseries:=Chart1.SeriesCount-1;
Chart1.Series[lastseries].ParentChart:=Chart1;
Chart1.Series[lastseries].SetFunction(TMovingAverageFunction.Create(Self));
// connect function series to datasource: in this case to first series
Chart1.Series[lastseries].DataSource:=Series2;
// How do I specify it to use close values of Series1 (Candleseries) ??
// Set additional EMA function properties:
With (Chart1.Series[lastseries].FunctionType as TMovingAverageFunction) do
begin
Period :=20;
end;
Chart1.Series[lastseries].CheckDataSource;
....

Series1 is a Candle Series. How does one specify that the values to use for the Moving Average are CLose values of CandleSeries ? I t is pretty easy in the Chart Editor but am unable to find the right syntax to do it inside the progra.

Will appreciate help/suggestions.

Satish

Posted: Thu Apr 28, 2005 11:57 am
by Marjan
Hi, Satish.
How does one specify that the values to use for the Moving Average are CLose values of CandleSeries ?
It's relatively simple:

Code: Select all

Chart1.Series[lastseries].YValues.ValueSource := 'Close';
...

Posted: Thu Apr 28, 2005 4:00 pm
by 9236155
Narcis,

Thanks a lot - you really have saved me a lot of effort . U guys are great !!

Satish

Posted: Fri Apr 29, 2005 7:32 am
by narcis
Hi Satish,

Thank you very much for your kind words but here the credit goes for Marjan :wink: .