PDA

View Full Version : Looking for a Moving Average function that return a single value


xewoox
12-06-2008, 05:47 AM
I am porting a Tradestation script. And I am looking for a function that efficiently do the moving average:
AverageFC (Function) AverageFC (Fast Calculation) series function (javascript:BSSCPopup('../el_definitions/series_function.htm');) is an Average (http://www.ninjatrader-support2.com/vb/average_function_.htm)of prices or values for some number of bars. It may also called a moving average, since the values are recalculated for every bar.

AverageFC (Function) 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.

AverageFC (Function) <h4>Examples

Assigns the 9 bar fast calculation moving average of the Close to Value1, then plots Value1:
Value1 = AverageFC(Close,9);

</h4>

NinjaTrader_Ray
12-06-2008, 03:49 PM
If you are looking for a simple moving average, then you will want to use our SMA() method.

More information -http://www.ninjatrader-support.com/HelpGuideV6/MovingAverageSMA.html