- calculate median (middle element)

Statistical functions
(AmiBroker 4.50)

SYNTAX Median( array, period )
FUNCTION The Median function - finds median (middle element) value of the array over period elements. Note that LOWER median is returned when 'period' is an even number. If you want to get average of upper and lower median for even 'periods' you need to use Percentile( array, period, 50 ) instead. It will do the averaging for you but runs slower.
EXAMPLE // list only symbols which volume is greater than
// median Volume from past 50 days
Filter = Volume > Median( Volume, 50 );
AddColumn( V, "Volume" );
SEE ALSO Percentile() function


The Median function is used in the following formulas in AFL on-line library:

More information:

See updated/extended version on-line.