Firetron’s Median

0 52 Views No Comments 1 month ago
  • 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:
    None

    Test Code:

    if not Load('done', false) then
    
      local table = {3, 8, 45, 23, 7, 2, 243}
    
      Log(table)
      Log('Unsorted Table:')
    
      local median = CC_Median(table)
    
      Log(median)
      Log('Median Value:')
    
      Save('done', true)
    
    end
    • This topic was modified 3 weeks, 5 days ago by Firetron. Reason: Used ArraySort instead of CC_MergeSort
    HaasScript Code
    Sign in or Register to view
Login or Register to Comment

Unlock your crypto trading potential

Create a free account and enjoy everything we have to offer.

Join for Free