@Joshua @generic
Hey Guys,
I figured it out. I tackled it from another angle based on the pointer @generic gave. Instead of depending on the Advance/Decline Line (Daily) reference used in the AdvanceDeclineCumulativeAvg indicator, I sought to replace this reference with the actual definition of Advance/Decline Line Daily. But in doing this, the definitions of advnDecl, advances, and declines HAVE TO BE ABOVE the percent change and cumulative calculations.
Lastly, are you guys coders? If so, alognside furthering my knowledge of thinkscript I plan on learning python. If any of you know this coding language and can point me in the right direction for self-study it'll be greatly appreciated.
-----
declare lower;
input exchange = {default NYSE, NASDAQ, AMEX, NQ_100, SP_500};
input length = 252;
def advances;
def declines;
switch (exchange) {
case NYSE:
advances = close("$ADVN");
declines = close("$DECN");
case NASDAQ:
advances = close("$ADVN/Q");
declines = close("$DECN/Q");
case AMEX:
advances = close("$ADVA");
declines = close("$DECA”);
case NQ_100:
advances = close("$ADVND");
declines = close("$DECLND");
case SP_500:
advances = close("$ADVSP");
declines = close("$DECLSP");
}
def advnDecl = (advances - declines) / (advances + declines);
def advnDecnPctChg = 1000 * advndecl;
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));
Hey Guys,
I figured it out. I tackled it from another angle based on the pointer @generic gave. Instead of depending on the Advance/Decline Line (Daily) reference used in the AdvanceDeclineCumulativeAvg indicator, I sought to replace this reference with the actual definition of Advance/Decline Line Daily. But in doing this, the definitions of advnDecl, advances, and declines HAVE TO BE ABOVE the percent change and cumulative calculations.
Lastly, are you guys coders? If so, alognside furthering my knowledge of thinkscript I plan on learning python. If any of you know this coding language and can point me in the right direction for self-study it'll be greatly appreciated.
-----
declare lower;
input exchange = {default NYSE, NASDAQ, AMEX, NQ_100, SP_500};
input length = 252;
def advances;
def declines;
switch (exchange) {
case NYSE:
advances = close("$ADVN");
declines = close("$DECN");
case NASDAQ:
advances = close("$ADVN/Q");
declines = close("$DECN/Q");
case AMEX:
advances = close("$ADVA");
declines = close("$DECA”);
case NQ_100:
advances = close("$ADVND");
declines = close("$DECLND");
case SP_500:
advances = close("$ADVSP");
declines = close("$DECLSP");
}
def advnDecl = (advances - declines) / (advances + declines);
def advnDecnPctChg = 1000 * advndecl;
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));