The Average Directional Index (ADX) was developed by J. Welles Wilder to help traders determine the strength of the trend. Two components that help you determine the direction of the trend are the Positive Directional Indicator (+DI) and Negative Directional Indicator (-DI).
The built-in ADX System uses two factors to signal and entry:
•The strength of the trend (ADX) needs to be greater than a certain threshold
•The cross over of the +DI and -DI
It uses a fraction of the ATR plus/minus the close to set the stop price.
The ADX System uses the following parameters:
Average True Range (days)
Sets the number of days to use when calculating the Average True Range
ATR Stop (fraction)
Sets the fraction (.5, 1.5, 3) of ATR to use for the stop width
ADX Periods to use (bars)
Sets the number of bars to use in calculating the ADX
ADX Trend Limit (adx)
Sets the minimum threshold for entering a trade
DI Period to use (bars)
Sets the number of bars to use in calculating the +DI and -DI
Entry Script
IF adxIndicator > adxTrendLimit AND
positiveDirectionalIndicator > negativeDirectionalIndicator AND
instrument.position <> LONG THEN
IF useATRStops THEN
broker.EnterLongOnOpen( instrument.close - averageTrueRange * atrStop )
ELSE
broker.EnterLongOnOpen
ENDIF
ENDIF
IF adxIndicator > adxTrendLimit AND
positiveDirectionalIndicator < negativeDirectionalIndicator AND
instrument.position <> SHORT THEN
IF useATRStops THEN
broker.EnterShortOnOpen( instrument.close + averageTrueRange * atrStop )
ELSE
broker.EnterShortOnOpen
ENDIF
ENDIF
Adjust Stops
' ---------------------------------------------
' Enter stop if "Use ATR Stops" is true
' ---------------------------------------------
IF useATRStops THEN
broker.ExitAllUnitsOnStop( instrument.unitExitStop )
ENDIF
Edit Time: 9/12/2020 9:50:00 AM |
Topic ID#: 103 |