Using Volume for Advance Decline Cumulative Avg?


Category:
0
0

Hi

Currently, TOS has the above indicator, but i will like to change the settings from using number of advances and declines to volume of advances and declines. Is it possible?

The full code for the indicator on TOS is

declare lower;

input exchange = {default NYSE, NASDAQ, AMEX};
input length = 252;

def advnDecnPctChg = 1000 * AdvanceDecline(type = “Advance/Decline Line (Daily)”, exchange = exchange);
def cumAdvnDecn = cumAdvnDecn[1] + if !IsNaN(advnDecnPctChg) then advnDecnPctChg else 0;

plot CumulAD = if !IsNaN(advnDecnPctChg) then cumAdvnDecn else Double.NaN;
plot AvgCumulAD = if !IsNaN(close) then Sum(if !IsNaN(CumulAD) then CumulAD else 0, length) / Sum(if !IsNaN(CumulAD) then 1 else 0, length) else Double.NaN;

CumulAD.DefineColor(“Above”, Color.UPTICK);
CumulAD.DefineColor(“Below”, Color.DOWNTICK);
CumulAD.AssignValueColor(if CumulAD > AvgCumulAD then CumulAD.Color(“Above”) else CumulAD.Color(“Below”));
AvgCumulAD.SetDefaultColor(GetColor(7));

If this question is too complicated, is ok. Thanks a lot

 

 

 

Marked as spam
Posted by (Questions: 1, Answers: 1)
Asked on December 19, 2022 1:04 am
106 views
0
Private answer

The indicator you have listed is using another indicator as it's source. That indicator is named "AdvanceDecline" and you would need to begin the modifications there. When you examine the source code for that indicator you find it is using the following ticker symbols for it's data source:

When "Exchange" is set to NYSE:

"$ADVN", "$DECN"

When "Exchange" is set to NASDAQ:

"$ADVN/Q", "$DECN/Q"

When "Exchange" is set to AMEX:

"$ADVA", "$DECA"

So based on which exchange is selected, the indicator uses one of those ticker symbol pairs to compute it's values. These ticker symbols are built-in indicators provided by Thinkorswim. They do not include volume data.

So in order to accomplish what you have requested you would first need to find out if Thinkorswim provides indicator ticker symbols which show the volume data for each of those symbol pairs. I have no idea if that is even available.

I suggest you contact TD Ameritrade support and ask them. But whatever solution may be possible, it starts right there at that point. Solve that, and we may have a way to accomplish what you requested.

Marked as spam
Posted by (Questions: 37, Answers: 4084)
Answered on December 19, 2022 10:24 am