Visual Basic (Declaration) | |
---|---|
Overloads Public Shared Function DMISignal( _ ByVal seriesName As String, _ ByVal s As Series, _ ByVal method As Integer, _ ByVal lengthOfMA As Integer _ ) As Series |
Visual Basic (Usage) | Copy Code |
---|---|
|
C# | |
---|---|
public static Series DMISignal( string seriesName, Series s, int method, int lengthOfMA ) |
Parameters
- seriesName
- The name of the series which will be displayed on the chart, i.e. its label.
- s
- A financial series where the first element contain the prices of last trading period, the second element represents the prices of the previous periods and so on. Please note that in order to calculate this indicator the elements of the financial series must contain High, Low and Close values.
- method
- Determines the methods used for the evaluation of the moving average in accordance
with the following key:
- 1 = Simple moving average
- 2 = Geometric moving average
- 3 = Linearly weighted moving average
- 4 = Exponentially Weighted Moving average within smoothing fact set to be 0.5.
For further details concerning the definition of these moving averages please see the accompanying PDF documentation or the API documentation for SimpleMovingAverage.
- lengthOfMA
- The number of periods over which the moving average is considered.
Return Value
Returns-1
, 0
, or 1
respectively according to whether a sell,
no action or buy signal is generated.At its simplest level to DMI system states that when the PDI crosses above the MDI a buy signal is generated and when the MDI crosses above the PMI then a sell signal is generated. This however may generate an excessive number of signals and hence we offer the possibility to smooth out these indicators according to a moving average which will help to reduce to sensitivity of the trading system.
Advantages to this Approach
This trading approach will reveal a trend before it is detected by most market participants. Once the trend becomes more widely recognized other market participants will tend to buy the tend and hence re-enforcing the trend dynamics. Hence the DMI system offers a good risk/reward trend following system.