AD line with investing data

Hello,

I have the investing plugin as a data provider and have tried to program the advanced decline line.
I have tried to do it with examples exposed in the forum, but they included the function "StaticVarAdd" and the version of Amibroker with which I work is 6.00.1.
I have programmed from an indicator in the book "The complete guide to Market Breadth Indicators" of Leonard P. Ayres, this indicator with an own list of assets.
The list must be entered manually, depending on the market in which it operates.
I hope it is useful, and that you report any errors that exist.

//// indicator derived from the book "The complete guide to Market Breadth Indicators". 
// this indicator uses a database in investing so the tickers in the list must be changed when done with another data provider.
// after the list there is a loop that chooses the values that go up and those that go down, accumulating the value. the AD value is plotted as the Line Advance Decrease, as well as its average of 150 periods.


_N( lista = ParamStr( "Tickers", "ACKB, AGES, ABI, APAM, ARGX, BAR, COFB, COLR, GLPG, GBLB, INGA, KBC, ONTEX, PROX, SOF, SOLB, TNET, UCB, UMI, WDPP, ADSGN, AD, AIRP, AIR, ALVG, AMA, ASML, AXAF, BASFN, BAYGN, BBVA, BMWG, BNPP, CRH, DAIGn, DANO, DPWGn, DTEGn, ENEI, ENGIE, ENI, ESLX, FREG, IBE, ITX, ISP, PRTP, OREP, LINI, LVMH, MUVGn, NOKIA, ORAN, PHG, SAF, SASY, SAN, SAPG, SCHN, SIEGn, SOGN, TEF, TOTF, SGEF, VIV, VOWG_p, URW, A2, AMPF, ATL, AZMT, BAMI, EMII, BZU, CPRI, CNHI, DIAS, EXOR, RACE, FCHA, FBK, GASI, HRA, IG, JUVE, LDOF, MDBI, MONC, NEXII, PIRC, PST, PRY, RECI, SPMI, SFER, SRG, STM, TLIT, TENR, TRN, UBI, CRDI, UNPI, US, ABBN, ADEN, ALCC, CSGN, GEBN, GIVN, LHN, LONN, NESN, NOVN, CFR, ROG, SGSN, SIKA, UHR, SLHN, SRENH, SCMN, UBSG, ZURN, AALB, ABNd, ADYEN, AEGN, AKZO, MT, ASRNL, HEIN, IMCD, DSMN, KPN, NN, RAND, REL, RDSa, TKWY,UNAVOPAWLSNcALSSBCP, CORA, CTT, EDPEDPR, GALP IBS, JMT, MOTA, NOS, PHRA, RAMA, RENE, SEM, YSO, SONAC, NVGR, BEIG, CONG, 1COV, DBKGn, DB1Gn, EONGn, FMEG, HEIG, HNKG_p, IFXGn, LHAG, MRCG, RWEG, TKAG, VNAn, WDIG, ROVI, FAE, PQR, YGMP, A3M, PRS, AEDAS, ENOR, HOME, YTST, RLIA, YZBL, DOMI, TLGO, TVAZ, LRES, TPZ, SLRS, ALNTA, GSJ, PHMR, MCM, ABG, BDL, CDRE, OHL, TUBA, EDRE, IBG, YTEM, RTA4, ADXR, APE, UBS, YATO, CBAV, ECR, RDM, NXTE, AZK, YURO, YORE, ABGek, ISUR, GREG, PRIM, CEV, EZEN, YAST, QBT, ANA, ACX, ACS, ADZ, AENA, AI, ALB, ALM, EATP, APPS, MTS, ARM, SABE, BKIA, BKT, BKY, BIOS, BME, BRIO, , CABK, GCO, CLNX, CIEA, CCEP, COL, CAF, OLEO, DIDA, MDF, EBRO, CCMC, ENAG, ENC, ELE, EKTL, FCC, FER, FLUI, GALQ, GEST, GRLS, GRLSbn, ICAG, IDR, LBK, LGT, LOG, MAP, TL5, MEL, MRL, MVC, MTBA, MASM, NATR, NTGY, NTH, NHH, NEA, IBES, ORY, PVA, PSG, CASHP, REE, RJFE, REN, REP, SCYR, SPSL, SGREN, SNCE, SPK, TUR, TRE, UNI, VID, VIS, VOC, VTSG, ZOT" ) );

for( n = 0; ( Symbol = StrExtract( Lista, n ) )  != "";  n++ )
    {

        SetForeign( symbol );

        AdvIss = C > Ref( C, -1 );
        DecIss = C < Ref( C, -1 );
    }     
    

AD =  AdvIss - DecIss;
LAD = Cum(AD);
r1 = ParamColor("Color", colorLightGrey);
r2 = ParamStyle("Style", styleDashed+styleThick);
Plot(LAD , "Linea Avance Descenso", r1, r2);
Plot(MA( LAD, 150 ),"MM150 AD", r1,r2);
1 Like

@milochenta, Thanks for sharing your code.

Don't forget to get yourself verified. Search for "Verified Badge" and follow the steps.