public static ADX Series(WealthLab.Bars bars, int period)
||The Bars object
ADX stands for Average Directional movement Index and is used to measure the overall strength of the trend. The ADX indicator is an average of DX
values. The ADX is a component of the Directional Movement System developed by Welles Wilder. This system attempts to measure the strength of price movement in positive and negative direction using the DIPlus
indicators along with the ADX.
The ADX is an excellent indicator for showing trend strength. The larger its value the stronger the current trend. A value above 25 is considered to be a trending market.
- When the ADX turns down from high values, then the trend maybe ending. It might be a good time to start closing open positions.
- If the ADX is declining, then the market is becoming less directional, the current trend is weakening. You should not be trading a trend system.
- When the ADX stays at a low value, the market is considered to be flat or dull. The longer the ADX stays at a low value the more likely a strong trending move will occur.
- If after staying low for a lengthy time, the ADX rises by 4 or 5 units, (for example, from 15 to 20), it gives a strong signal to trade the current trend.
- If the ADX is rising then the market is showing a strengthening trend. The value of the ADX is proportional to the slope of the trend. The slope of the ADX line is proportional to the acceleration of the price movement (changing trend slope). If the trend is a constant slope then the ADX value tends to flatten out.
ADX is equivalent to the Wilder's moving average (see WilderMA
) of the direction movement (DX
) over the specified Period.
public class MyStrategy : WealthScript
private StrategyParameter paramPeriod;
paramPeriod = CreateParameter("ADX Period", 10, 10, 30, 1);
// Thank you fundtimer
public Color WS4ColorToNET( double WS4Color )
(int)Math.Floor( ( WS4Color % 1000 ) / 100 * 28.4 ),
(int)Math.Floor( ( WS4Color % 100 ) / 10 * 28.4 ),
(int)Math.Floor( WS4Color % 10 * 28.4 ) );
protected override void Execute()
// Use ADX to determine how much prices are trending, color bars accordingly
int period = paramPeriod.ValueInt;
// ADX is one of "unstable" indicators, see Language Guide for information
for(int bar = period*3; bar < Bars.Count; bar++)
SetBarColor( bar, WS4ColorToNET( Math.Round( ADX.Series( Bars, period )bar / 5 )*100 ) );