ADX Lookback

Studies that have been contributed to the community by other users. If you’ve got something useful to share, that’s great!
LTG
Posts: 30
Joined: 08 Sep 2009

ADX Lookback

Postby LTG » 07 Oct 2009

Can anyone assist, i'm trying to include the ability on this indicator to look back over a longer period of time, rather than the previous bar only. Ideally, I want to be able to set the lookback period anywhere from 1- 500 bars in order to ascertain the trend of the ADX based on the resolution of the chart:

Code: Select all

{1.0 Inputs and Variables}

{1.1. Declaration of Inputs}
Inputs:
ADXLenght (14),
UpColor (cyan),
DnColor (magenta),
UnChngColor (white);


{1.2. Declaration of Variables}
variables:
var0 (0),
var1 (0),
var2 (0),
var3 (0),
var4 (0),
var5 (0);

{2.0. Start Code}

{2.1. Call ADX & DMI}
Value1 = DirMovement(High, Low, Close, ADXLenght, var0, var1, var2, var3, var4, var5);

{2.2. Check Slope and SetPlotColor}

if var3 > var3[1] then
SetPlotColor[1](3, UpColor)
else
if var3 < var3[1] then
SetPlotColor[1](3, DnColor)
else
SetPlotColor[1](3, UnChngColor);


{3.0. Plot Values}
Plot1(var0, "DMI+");
Plot2(var1, "DMI-");
Plot3(var3, "ADX");

Return to “User Contributed Studies and Indicator Library”