-
Finds the middle value of a table of values. If there is an even number of elements, takes the average of the 2 middle values.
Custom Command Dependencies:
NoneTest Code:
if not Load('done', false) then local table = Grab(ClosePrices(), 0, 9) Log(' ') Log(table) Log('Unsorted Table:') Log(' ') Log(ArraySort(table)) Log('Sorted Table:') Log(' ') local median = CC_Median(table) Log(median) Log('Median Value:') Log(' ') Save('done', true) end
- This topic was modified 2 years, 2 months ago by . Reason: Used ArraySort instead of CC_MergeSort
- This topic was modified 2 years, 1 month ago by . Reason: Added param isSorted
- This topic was modified 2 years, 1 month ago by . Reason: Made it work for ListNumber as well as Table
- This topic was modified 2 years, 1 month ago by . Reason: Changed test code