MarketScript > Functions > Aggregating |
wagg (expr [, type] [, startday] [, reportday] [,endday])
Stream of data to be aggregated
Aggregation type.
values:
avg, average
last
first
low
high
mid - midpoint between high and low
sum
default: avg
Week day to be used as a first day of aggregation period within a week.
values:
su, sun, sunday
mo, mon, monday
tu, tue, tuesday
we, wed, wednesday
th, thu, thursday
fr, fri, friday
sa, sat, saturday
default: sun
Week day to be used to tag the aggregated values.
values: see startday.
default: startday
Week day to be used as a last day of aggregation period within a week.
values: see startday.
default: 6th day after startday
wagg("/GCL[0]")
wagg("/GCL[0]", high, mon, tue)
wagg("/GCL[0]", type:high, startday:mon, reportday:tue)
wagg( ("/GCL[0]" + "/GCL[1]") / 2 )
wagg("/GCL[0]", mid, fri, mon)
wagg("/GCL[0]", type:mid, startday:fri, reportday:mon)
wagg("/GCL[0]", type:high, startday:mon, endday:fri, reportday:mon)
magg (expr [, type] [, startday] [, reportday] [, endday] [, startoffset] [, reportoffset])
Stream of data to be aggregated
Aggregation type.
values: see wagg function.
default: avg
Day of month to be used as a start point of aggregation.
values: 1..31
default: 1
Day of month to be used to tag the aggregated values.
values: 1..31
default: startday
Day of month to be used as a end point of aggregation.
values: 1..31
default: startday-1 of next month
Month offset for shifting startday number of months forward or backward.
values: positive or negative integer numbers depending on shift direction
default: 0
Month offset to shift reportday number of months forward or backward
values: see startoffset
default: 0
magg("/GCL[0]")
magg("/GCL[0]", avg, 15, 31, -1, 1)
magg("/GCL[0]", type:mid, reportday:10)
qagg (expr [, type] [, startday] [, reportday] [, endday] [, startoffset] [, reportoffset])
(see magg function)
qagg("/GCL[0]")
yagg (expr [, type] [, startday] [, reportday] [, endday] [, startoffset] [, reportoffset])
(see magg function)
yagg("/GCL[0]")
cagg(expr [, type])
Stream of data to be aggregated
Aggregation type.
values: see wagg function.
default: avg
cagg("/GCL", type:mid)
Parameters in aggregation functions can be specified in the order of their appearance in function declaration. Optional parameters can be omitted, and can be specified out of order using named parameter form, e.g.:
wagg("/GCL[0]", startday: mon, endday: fri, reportday: fri)
magg("/GCL[0]", startday:15, reportday: 1, reportoffset: 1)