TrimMean (Function)
The TrimMean function calculates the Interior Mean value of the specified bar after trimming extremes.
Syntax
TrimMean(Price, Length, TrimPct)
Returns (Double)
A numeric value containing the mean of a range of bars. If TrimPct is less than 0, or TrimPct is greater than 1, then the Function will return a -1.
Parameters
Name |
Type |
Description |
Price |
Numeric |
Specifies which bar value (price, function, or formula) to use. |
Length |
Numeric |
Sets the number of bars used in the calculation. |
TrimPct |
Numeric |
Sets the percentage of data to exclude from calculation. Enter 0.20 for 20% which will exclude 10% of the data values from each end of the number of bars selected. |
Remarks
TrimMean calculates the mean taken by excluding a percentage (TrimPct) of data points from the top and bottom tails of a data set. This function can be used to exclude outlying data from your analysis.
If TrimPct is less than 0 or if TrimPct is greater than 1, the function will return -1
Examples
Assigns to Value1 the TrimMean value calculated over the past 14 closing prices with a TrimPct of .25 or 25%:
Value1 = TrimMean(Close, 14, .25);
Assigns to Value2 the TrimMean value calculated over the past 14 High prices with a TrimPct of .10 or 10%:
Value2 = TrimMean(High, 21, .1);