Function Series under Program Control
Posted: Wed Apr 27, 2005 12:39 pm
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
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