DirMovement (Function)
The DirMovement series function calculates the Directional Movement values described by Welles Wilder.
The DirMovement function is a multiple-output function that consolidates the calculations of several related functions: ADX, ADXCustom, ADXR, ADXRCustom, DMI, DMICustom, DMIMinus, DMIMinusCustom, DMIPlus, and DMIPlusCustom.
Syntax
DirMovement(PriceH,PriceL,PriceC,Length,oDMIPlus,oDMIMinus,oDMI,oADX,oADXR,oVolatility)
Returns (Integer)
The oDMIPlus, oDMIMinus, oDMI, oADX, oADXR, and oVolty output parameters return the related directional movement values. The DirMovement function itself returns a value of 1.
Parameters
Name | Type | Description |
PriceH | Numeric | Specifies which bar value (price, function, or formula) to use for the directional movement high price. |
PriceL | Numeric | Specifies which bar value (price, function, or formula) to use for the directional movement low price. |
PriceC | Numeric | Specifies which bar value (price, function, or formula) to use for the directional movement close price. |
Length | Numeric | Sets the number of bars to consider for the average directional movement index rating calculation. |
oDMIPlus | Numeric | Outputs the DMIPlus value. |
oDMIMinus | Numeric | Outputs the DMIMinus value. |
oDMI | Numeric | Outputs the DMI value. |
oADX | Numeric | Outputs the ADX value. |
oADXR | Numeric | Outputs the ADXR value. |
oVolty | Numeric | Outputs the volatility value. |
Remarks
The PriceH, PriceL, and PriceC input parameters will need to reference some High, Low, and Close values based on the symbol(s) in your chart.
The value for the Length input parameter should always be a positive whole number.
See Multiple Output Function for more information on using output parameters to return values.
Example
Assigns to Value2 the calculated 14 bar ADX value passed by reference to the oADX parameter, and assigns to Value3 the calculated 14 bar ADXR value passed by reference to the oADXR. Value1 is assigned the value of 1:
Value1 = DirMovement (High, Low, Close, 14,
oDMIPlus, oDMIMinus, oDMI, oADX, oADXR, oVolatility);
Value2 = oADX;
Value3 = oADXR;
This example only uses 2 of the 6 output parameters, although the other output values are still valid.
Reference
Wilder, J. Welles, Jr. New Concepts in Technical Trading Systems (Greensboro, NC: Trend Research, 1978).
Colby, Robert F., Myers, Thomas. A. The Encyclopedia of Technical Market Indicators. Dow Jones – Irwin. Homewood, IL. 1988.
Murphy, John J. The Visual Investor. New York, NY: John Wiley & Sons, Inc. 1996.