Page 1 of 1

TCandleSeries AddNull

Posted: Thu Sep 15, 2005 8:25 am
by 9232125
How can I add a "null candle" to a TCandleSeries?
I have two CandleSeries on the same chart, but dates of two series are not synchronized. For example, I can have two date sequences like

1st series: ..., 1 sep, 2 sep, 5 sep, 6 sep, 7 sep, 8 sep, 9 sep, 12 sep, ...
2nd series: ..., 1 sep, 2 sep, [no val], [no val], [no val], 8 sep, 9 sep, 12 sep, ...

so I need to introduce some invisible candle in 2nd series to keep it synchronized with 1st series on the chart.
Any idea?

Thanks
Best regards

FM

Posted: Thu Sep 15, 2005 8:52 am
by narcis
Hi FM,

You don't need to add null values to a TCandleSeries. If you add a candle for each specific date, 2nd series won't draw candles for the days that doesn't have data. The example below shows you that, Series2 has a gap from 5-Sept to 10-Sept and is still synchronized with Series1.

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var
  i: Integer;
begin
  Randomize;

  for i:=1 to 15 do
  begin
    Series1.AddCandle(EncodeDate( 2005, 9, i),random,random,random,random);
    if ((i < 5) or (i > 10)) then
      Series2.AddCandle(EncodeDate( 2005, 9, i),random,random,random,random);
  end;

  Series1.XValues.DateTime:=True;
end;