#### markos

##### Well-known member

**VIP**

From TSL - Mobius posted 7-16-2019

# 10:11

#10:22 MTS1: Thanks Mobius!

#10:26 binh4984: Thank you very much Mobius for your help.

#10:33 Mobius: yw And, bin...

#10:35 Mobius:

#10:36 Mobius: See the True Momentum Indicator for a method to do that and adding a weight adjusted by the closing value of AD might be useful

#10:37 MTS1: I guess an average on a cumulative AD could be some sort of signal line. I know some analysts look at longer term MI's like that, also # stocks above or below an MA, new highs/lows etc. But I think AD / VOLD etc are probably more useful intraday.

(I would not endorse #3 of 3 as I don't see it's utility: markos)

# 10:11

**Mobius: AD is an Intraday indicator. It's daily closing value isn't of any value since where it closes in relation to the closing price has no correlation**### Code # 1 of 3

# 10:14**Mobius: here is an AD label that includes the open, high and low of the day with bubbles plotted at those price locations on the chart.**
Code:

```
# AD Label
# Mobius
# V01
def RTH = getTime() >= regularTradingStart(getYYYYMMDD()) and
getTime() <= regularTradingEnd(getYYYYMMDD());
def o = if RTH and !RTH[1]
then open("$ADSPD")
else o[1];
def c = if isNaN(close("$ADSPD"))
then c[1]
else close("$ADSPD");
def x = barNumber();
def sumx = if RTH and !RTH[1]
then 1
else if RTH then sumx[1] + 1
else if !RTH
then sumx[1]
else sumx[1];
def sumAD = if RTH and !RTH[1]
then c
else if RTH
then sumAD[1] + c
else sumAD[1];
def h = if isNaN(high("$ADSPD", "DAY"))
then h[1]
else high("$ADSPD", "DAY");
def ADHighBar = if high("$ADSPD") == h
then x
else double.nan;
AddChartBubble(barNumber() == HighestAll(ADHighBar),
high + (2 * TickSize()),
"AD",
color.cyan);
def l = if isNaN(low("$ADSPD", "DAY"))
then l[1]
else low("$ADSPD", "DAY");
def ADLowBar = if low("$ADSPD") == l
then x
else double.nan;
AddChartBubble(barNumber() == HighestAll(ADLowBar),
low - (2 * TickSize()),
"AD",
color.orange,
no);
def Avg = Round(sumAD / sumx, 0);
addLabel(1, "AD open " + o +
" high " + h +
" low " + l +
" close " + c +
" Avg " + Avg, if c < 0
then color.red
else color.green);
# End Code AD Label
```

### Code # 2 of 3

#10:18**Mobius: Here's AD Scaled to Price and plotted along with a plot of the AD zero line at price where crosses. Which is often a price pivot area.**
Code:

```
# AD Scaled To Price
# Mobius
# Changed original code to use RegularTrading(Start, End) functions. Use RTH Only.
# V02 2019
script Scale {
input h = high;
input l = low;
input c = close;
def RTH = getTime() >= RegularTradingStart(getYYYYMMDD()) and
getTime() <= RegularTradingEnd(getYYYYMMDD());
def max = if RTH and !RTH[1]
then high
else if RTH and high > max[1]
then high
else max[1];
def min = if RTH and !RTH[1]
then low
else if RTH and low < min[1]
then low
else min[1];
def hh = if RTH and !RTH[1]
then h
else if RTH and h > hh[1]
then h
else hh[1];
def ll = if RTH and !RTH[1]
then l
else if RTH and l < ll[1]
then l
else ll[1];
plot Range = (((Max - Min) * (c - ll)) / (hh - ll)) + Min;
}
plot Scaled_Symbol = scale(high("$ADSPD"), low("$ADSPD"), close("$ADSPD"));
Scaled_Symbol.AssignValueColor(if Scaled_Symbol > Scaled_Symbol[1]
then color.green
else color.red);
Scaled_Symbol.SetLineWeight(2);
Scaled_Symbol.HideBubble();
Scaled_Symbol.HideTitle();
def zero = if close("$ADSPD") crosses 0
then close
else zero[1];
def zero_bar = if close("$ADSPD") crosses 0
then barNumber()
else double.nan;
plot zeroLine = if barNumber() >= highestAll(zero_bar)
then highestAll(if isNaN(close[-1])
then zero
else double.nan)
else double.nan;
zeroLine.SetDefaultColor(Color.Light_Gray);
zeroLine.SetStyle(Curve.Points);
zeroLine.SetLineWeight(2);
zeroLine.HideBubble();
zeroLine.HideTitle();
AddChartBubble(barNumber() == HighestAll(barNumber()),
zeroLine,
"AD 0",
zeroLine.TakeValueColor());
# End Code
```

#10:26 binh4984: Thank you very much Mobius for your help.

#10:33 Mobius: yw And, bin...

**you might consider the fact that AD is an oscillator that ranges around 0. So taking a daily average of it's closing value would be that same as taking the daily closing average of any oscillator**#10:35 Mobius:

**won't tell you anything of value.**Now you could write a binary momentum indicator using AD on a daily basis that would tell you when a trend is in place and the momentum of that trend#10:36 Mobius: See the True Momentum Indicator for a method to do that and adding a weight adjusted by the closing value of AD might be useful

#10:37 MTS1: I guess an average on a cumulative AD could be some sort of signal line. I know some analysts look at longer term MI's like that, also # stocks above or below an MA, new highs/lows etc. But I think AD / VOLD etc are probably more useful intraday.

(I would not endorse #3 of 3 as I don't see it's utility: markos)

### Code #3 of 3

Code:

```
#10:42 Mobius:
# Cumulative AD
declare lower;
plot Data = TotalSum(close("$ADSPD"));
plot "0" = 0;
#EOC#
```

Last edited: