Adv / Decl Line Indicator

Questions about MultiCharts and user contributed studies.
tonyt
Posts: 48
Joined: 21 May 2021
Has thanked: 20 times
Been thanked: 1 time

Adv / Decl Line Indicator

Postby tonyt » 12 Jan 2023

Hello Code Gurus,

I am trying to create an ADL indicator that measures the instrument on Data1 against itself with the following code:

Code: Select all

inputs: period(14); variables: ADL(0), HL(0), CLV(0); HL = (high + low)/2; CLV = ((close - low) - (high - close)) / (high - low) * volume; ADL = ADL[1] + CLV; plot1(Average(ADL, period), "ADL MA", green);
What I get basically works except that the total value for the ADL is accumulating as a running total as you can see in this screenshot, bottom right. Why is this happening and does it mean that the indicator will eventually max out as an output because it exceeds the MC max digits for same? I am attempting to replicate the native ADL indicator from TradingView, coded in PineScript, with this pared down version. Thanks for your insights!
Attachments
ADL Indicator Screenshot.png
(47.86 KiB) Not downloaded yet

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Adv / Decl Line Indicator

Postby TJ » 12 Jan 2023

In a Zero-Sum game, the curve will balance out after the ramp-up period.

However, the market is not zero-sum; the market has an upward bias. Therefore, yes, the way you calculate it, the curve will also have an upward bias.


Return to “MultiCharts”