Linear Regression Slope of DM+

Good day fellow scriptwriters,

I’ve been using a linear regression slope applied to the DM+ line of the Average Directional Movement Index, which works great (see attached). Now I’m trying to find a way to create a script using the LRSLOPE function, but LRSLOPE doesn’t offer an option of applying it to another indicator or part thereof. If anyone has any ideas on how this can be accomplished, I would be most grateful. Thank you.

Hi Fabien,

With our scripting language you can nest functions inside each other, so in this example variable V1 calculates the DM+ value and the next line calculates the LRSlope of V1 (ie the ADX). Copy and paste the following to a Show View or Show Bar and it will highlight when the slope is up:

V1 = ADX(DEFAULT=DMPlus, BARS=14);
LRSLOPE(V1, BARS=15) IsUp