YOUSEFUL / DELPHI / COMPONENTS
TAtlasBarPeriod
The calendar period TAtlasBarSeries.Aggregate combines bars into.
Description
Weeks start on Monday. Each aggregated bar is stamped with the start of its period.
Members
| Member | Kind | What it does |
|---|---|---|
bpWeek | value | Calendar weeks, Monday to Sunday; bars are stamped with the Monday. |
bpMonth | value | Calendar months; bars are stamped with the 1st. |
bpYear | value | Calendar years; bars are stamped with 1 January. |
Values
bpWeek value
bpWeekCalendar weeks, Monday to Sunday; bars are stamped with the Monday.
bpMonth value
bpMonthCalendar months; bars are stamped with the 1st.
bpYear value
bpYearCalendar years; bars are stamped with 1 January.
Examples
Monthly closes
Aggregates to months and prints each month's close.
uses System.SysUtils, Atlas.FinData;
procedure PrintMonthlyCloses(Data: TAtlasBarSeries);
var
Monthly: TAtlasBarSeries;
I: Integer;
begin
Monthly := Data.Aggregate(bpMonth);
try
for I := 0 to Monthly.Count - 1 do
Writeln(FormatDateTime('yyyy-mm', Monthly[I].Time), ' ', FormatFloat('0.00', Monthly[I].Close));
finally
Monthly.Free;
end;
end;