AverageFC (Function)
The AverageFC (Fast Calculation) series function is an Average of prices or values for some number of bars. It may also be called a moving average, since the values are recalculated for every bar.
Syntax
AverageFC(Price, Length)
Returns (Double)
A numeric value for the current bar.
Parameters
Name | Type | Description |
Price | Numeric | Specifies which bar value (price, function, or formula) to use. |
Length | Numeric | Sets the number of bars to consider. |
Remarks
The AverageFC function is often used to smooth the values of functions or indicators.
AverageFC (fast calculation arithmetic mean) subtracts the oldest value in the list of elements, adds the newest value, and then divides by the number of elements.
The input parameter Price can be a bar value such as Close, High, Low, Open, or Volume. It can also be any mathematical calculation such as (High + Low) / 2, or a numeric function such as RSI, Stochastic, or ADX.
The value for the Length input parameter should always be a whole number, greater than 0.
This series function returns exactly the same values as Average except that it uses a fast calculation method that takes slightly more memory than the non-FC version.
Examples
Assigns the 9 bar fast calculation moving average of the Close to Value1, then plots Value1:
Value1 = AverageFC(Close,9);
Plot1(Value1, "AvgClose");
Assigns the 15 bar fast calculation moving average of the range;(High + Low)/2 to Value1, then plots Value1:
Value1 = AverageFC((High + Low)/2,15);
Plot1(Value1, "AvgRng");
Assigns the 10 bar fast calculation moving average of the RSI function to Value1, then plots Value1:
Value1 = AverageFC(RSI(Close,14),10);
Plot1(Value1, "AvgRSI");
Assigns the 20 bar fast calculation moving average of the custom variable myRange to Value1, then plots Value1:
Vars: myRange(((High[1]-Low[1]) + (High – Low))/2;
Value1 = AverageFC(myRange, 20);
Plot1(Value1, "AvgRng");