Visual Basic (Declaration) | |
---|---|
Overloads Public Shared Function MedianMovingAverage( _ ByVal seriesName As String, _ ByVal highSeries As Series, _ ByVal highSeriesElementValue As ElementValue, _ ByVal lowSeries As Series, _ ByVal lowSeriesElementValue As ElementValue, _ ByVal lengthOfMA As Integer _ ) As Series |
Visual Basic (Usage) | Copy Code |
---|---|
|
C# | |
---|---|
public static Series MedianMovingAverage( string seriesName, Series highSeries, ElementValue highSeriesElementValue, Series lowSeries, ElementValue lowSeriesElementValue, int lengthOfMA ) |
Parameters
- seriesName
- The name of the series which will be displayed on the chart, i.e. its label.
- highSeries
- An array where the first element corresponds to the highest market price during the last trading period, the second element corresponds to the highest market price in the previous period, and so on.
- highSeriesElementValue
- Specifies the particular element value (for example High, Low, Close or Open of the financial time series) which will be considered within this indicator evaluation. In particular, if you wish to use the element value high then you should pass the parameter High. In a similarly fashion if you wish to use the low, close or open, then you should pass the parameter Low, Close, Open, respectively.
- lowSeries
- An array where the first element corresponds to the lowest market price during the last trading period, the second term corresponds to the lowest market price in the previous period, and so on.
- lowSeriesElementValue
- Specifies the particular element value (for example High, Low, Close or Open of the financial time series) which will be considered within this indicator evaluation. In particular, if you wish to use the element value high then you should pass the parameter High. In a similarly fashion if you wish to use the low, close or open, then you should pass the parameter Low, Close, Open, respectively.
- lengthOfMA
- The number of periods considered within the evaluation of the moving average of each of the days on which it can be evaluated.
Return Value
A series where the first term is the value of the Median Moving Average for the most recent period, the second term is the value of the Median Moving Average for the previous period and so on.Exception | Description |
---|---|
ArgumentException | Thrown if the series historicalHigh and historicalLow are of different lengths or if one of these arrays is empty. |
For example, if we are considering a trading asset and the periods considered are days
then by passing an series containing the closing daily prices of a given asset, and by choosing to
use the 5-day median moving average (i.e. passing a length of the MA of
5
), then we will
evaluate the Median Moving Average(GMA) for all days for which the closing price on that day and
the four previous days is known.
Remark: This indicator is particularly appropriate for traded assets where the opening and closing prices are unreliable. Such an instance are FTSE stocks which in the first hour of trading experience relatively low volumes and the closing prices are settled through an auction process. Hence for the FTSE market the quoted market price at the beginning and end of the market may not be indicative of where a given stock is trading within a given period. In such markets it may be more appropriate to use the Median Moving Average which will smooth out the effect of uncharacteristic shifts at the ends of the trading day.