Jump to content
Sign in to follow this  
merlin8121

Momentum scanner

Recommended Posts

// Var Name: "BollingerBands_Top" contains Bollinger Bands(20,2).Top
// Var Name: "PriceChannels_Top" contains Price Channels(20).Top
// Var Name: "PriceChannels_Bottom" contains Price Channels(20).Bottom
// Var Name: "BollingerBands_Bottom" contains Bollinger Bands(20,2).Bottom
// Var Name: "VWAP_Line" contains VWAP (Intraday)().Line
// Var Name: "PriceChannels_Center" contains Price Channels(20).Center
// Var Name: "FibonacciPivots_Res1" contains Fibonacci Pivots (Intraday)(def).Res1
// Var Name: "RSI_Line" contains RSI(20,2).Line
// Var Name: "CCI_Line" contains CCI(14).Line

public void MainCalculation()
{DefinePaintbarParameter("MINVOL", "Bar Volume", true,0, 1000000000000, 1000, 15000);
    
    if (BarVolume<GetPaintbarParameter("MINVOL"))
        
        return;
    if (Close > BollingerBands_Top)
    {
        SetColorAndShape(SysColor.MainIndicator2, PBShape.Rectangle);
        SetScanResult("Boll UP");
        return;
    }
    if (Close > PriceChannels_Top)
    {
        SetColorAndShape(SysColor.MainIndicator2, PBShape.ArrowNE);
        SetScanResult("Donchiian Upp");
        return;
    }
    if (Close < PriceChannels_Bottom)
    {
        SetColorAndShape(SysColor.MainIndicator7, PBShape.ArrowSE);
        SetScanResult("Donchiian Down");
        return;
    }
    if (Close < BollingerBands_Bottom)
    {
        SetColorAndShape(SysColor.MainIndicator7, PBShape.Rectangle);
        SetScanResult("Boll  Down");
        return;
    }
    if (Close.CrossesUp(VWAP_Line, 0))
    {
        SetColorAndShape("Vwap", PBShape.W, SysColor.MainIndicator1);
        SetScanResult("VWAP UP");
        return;
    }
    if (Close.CrossesUp(PriceChannels_Center, 0))
    {
        SetColorAndShape(SysColor.MainIndicator2, PBShape.ArrowNE_Hollow);
        SetScanResult("Donchian center cross");
        return;
    }
    if (Close.Crosses(FibonacciPivots_Res1, 0))
    {
        SetColorAndShape(SysColor.Annotations, PBShape.TriangleUp_Hollow);
        SetScanResult("Cross fib Resist");
        return;
    }
    if (RSI_Line < 30)
    {
        SetColorAndShape(SysColor.MainIndicator3, PBShape.Circle);
        SetScanResult("Oversold");
        return;
    }
    if (BarVolume > BarVolume[1])
    {
        SetColorAndShape(SysColor.MainIndicator5, PBShape.ArrowUp);
        SetScanResult("Vol UP");
        return;
    }
    if (CCI_Line.CrossesUp(-150, 0))
    {
        SetColorAndShape("CCI", PBShape.C, 0xFF0A54FF);
        SetScanResult("CCI -150 up");
        return;
    }

}

 

MOM Scanner.png

  • Like 1

Share this post


Link to post
Share on other sites

Usually i use 1200 symbols with this scan (with yahoo) and all is running perfect:) . At the same time i have another portfolio with IQfeed quotes open. 

The scan is fast, easy and accurate.  Good job !

Share this post


Link to post
Share on other sites

This is the actual list of  1372 symbols  to use with the scanner with yahoo quotes, just copy/paste in a new portfolio.:

 

MCF, SKY, TOPS, GEVO, DPW, NVCN, SVU, WRN, GALT, IDRA, ASNA, SRCI, BLIN, AKS, CRC, BLDP, FALC, OAKS, CETV, CHKE, SAND, GCAP, UEC, HEB, KOOL, NVAX, TEAR, IMUC, TZA, NE, DNR, EVEP, BLFS, ROYT, DXTR, OZM, UAN, WG, BSTG, ALRN, PIXY, TGP, AAC, AAU, AAV, ABEO, ABR, ACHN, ACRX, DAC, ACTG, ADES, ADHD, ADK, ADMP, ADXS, ABUS, AEZS, VRML, AFMD, AG, AGEN, AGFS, AGI, AGRX, AGTC, AHT, ALIM, CARA, ADAP, SPWR, ZN, HZNP, AINV, AKG, ALDX, ALQA, ALSK, AMBR, AMCN, AMDA, AMPE, AMRC, AMRN, AMRS, AMSC, AMTX, PTIE, ANFI, ANH, ANTH, ANY, APDN, APHB, GLOW, JAGX, CPHI, LODE, AKTS, EARS, ARDM, APPS, APRI, APTO, ARAY, ARC, ARCO, ARDX, QBAK, AREX, ARGS, ARLZ, ARNA, ARQL, ARRY, ARTX, ARWR, ASC, ASM, ASRV, AST, ASYS, AT, ATEC, ATEN, ATHX, ATNM, ATOS, ATRS, ATW, AUDC, AUMN, AUPH, AVEO, AVGR, AVH, AVID, AVP, AVXL, AXAS, AXN, AXSM, AXTI, AXU, BBG, BBOX, BCOV, BCRX, BDE, BDSI, BEBE, BETR, BIOA, BIOC, BIOS, BKCC, BKMU, BKS, BKT, BLPH, BLRX, BNED, BONT, BOOT, BPMX, BPTH, BTE, BTX, BV, BVX, BWEN, BXE, CACB, CALL, CALX, CAMT, CAPR, CASC, CATB, CBAY, CBIO, CBK, CBL, CBLI, CBMX, CCCR, CCIH, CCLP, CCM, CCO, CCXI, CDE, CDNA, CDR, CDTI, CDTX, CDXC, CECE, SQNS, CERC, CECO, CEMP, CERS, CETX, CFMS, CGA, CGEN, NEON, WKHS, AUG, SRAX, QURE, GAZ, AKTX, PN, CGI, CGIX, CIA, CIE, CIK, CLD, CLDX, CLF, CLMT, FPP, CLNE, CLNT, CLSN, CMLS, CMRE, CMRX, CNAT, CNIT, CNTY, CO, COLL, CORI, CPLP, CPRX, CPST, CRBP, CRD-B, CRIS, CRK, CRMD, CRME, CRNT, MRTX, RIBT, CROX, ABIO, ABTL, ACCO, ACTA, ADMS, ADRO, AGRO, AHH, AI, AIRI, AKBA, ALDR, NYT, ALO, AMAG, AMBC, AMPH, AMSWA, ANF, ANGI, ANGO, ANW, APTS, AQMS, ARI, ARLP, ATI, ATRA, AXGN, AXL, BCLI, BCOR, CVE, BEL, BGC, BGFV, BIOL, BKE, BLCM, BLDR, BNCL, CHK, DARE, BOJA, BPFH, AUY, BPI, BRG, BRKL, BRS, BW, BWG, BZH, CAFD, CALA, CAMP, MDVX, PDFS, TROV, IBIO, DCTH, CATO, CBB, CBI, CBZ, CCC, CCRN, CENX, CFFN, CHEF, CHGG, CHMI, CHRS, CHS, CHY, CIO, CLS, CMCM, CMO, CMTL, CNNX, CNXR, CODI, COHU, CONN, CORT, COWN, CRAY, CRCM, CRR, CRZO, CSIQ, CSLT, CSTM, CSU, CTMX, CTRE, CTRV, CVA, CVEO, CVGI, CVM, CVRR, CVRS, CWST, CXRX, CYD, CYH, CYS, CYTK, CYTR, CYTX, CZR, CZZ, DAIO, DCIX, DCOM, DDC, DENN, DEPO, DF, DFRG, DGLY, DHT, DHX, DHY, DNN, FUEL, DIAX, DL, DLNG, DLTH, DNOW, DO, DPLO, DRD, DRRX, DRYS, DSPG, DSW, DSX, DVAX, DXLG, LABD, DYN, EBIO, ECR, ECYT, EDD, EDIT, EEQ, EGHT, EGLE, EGLT, EGO, EGOV, EGY, EIGI, EKSO, ELGX, ELOS, ELP, ELY, EMES, EMKR, ENOC, ENPH, ENRJ, ENSV, ENT, ENTL, ENVA, ENZ, EOI, EOS, EPE, EPZM, ERF, ERI, ERII, ERN, EROS, ESES, ESIO, ESNC, ESND, ESV, ETJ, ETM, ETSY, EURN, EVAR, EVC, EVLV, EVRI, EVTC, EVV, EXK, EXPR, EXTR, EYEG, EYES, EZPW, FATE, FAX, FBIO, FBP, FCEL, FCF, FCH, FENG, FET, FGP, FI, FINL, FIT, FLY, FMSA, FNFV, FNJN, FOE, FOLD, BASI, VKTX, CLM, PACB, IFON, JONE, FOMX, FOR, FORM, FOSL, FPI, FPO, FRAC, FRAN, MBOT, FRBK, FRED, FRGI, FRO, OCRX, VHI, SCYX, IPWR, FRP, FRPT, FSC, FSM, FSP, FSS, FTD, FTK, GALE, GBDC, GCI, GEN, GERN, GES, GIM, GLBL, GLBS, GLDD, GLOG, GLT, GLUU, GLYC, GMO, GNC, GNCA, GNMK, GNRT, GNW, GOGL, GOGO, GOL, GOLF, GORO, GOV, GPL, GPRO, GRAM, GSS, GST, GSV, GTE, GTN, GV, HABT, HALO, HBM, HBP, HCC, HCHC, HCKT, HCLP, HDP, HDSN, HEAR, HEES, HIFR, HIL, HIMX, HIVE, HK, HL, HLIT, HLTH, HLX, HMHC, HMNY, HMSY, HMY, HOLI, HOS, HOV, HRTX, HSC, HT, HTBX, HTGC, HTGM, HTZ, HUSA, TRXC, CLUB, FVE, CAW, MIND, ORIG, RVP, SNES, CGNT, INFI, NLNK, SNDE, MTSL, DTEA, IRMD, CSBR, ABAC, NOVN, HZN, ICON, IDT, IDXG, IGC, FLKS, IGD, IMGN, IMMU, INAP, INFN, INN, INNL, INO, INOV, INSM, INSY, INVA, INWK, IO, IPCI, IPI, IPXL, IRDM, IRET, IRT, ITCI, ITEK, ITUS, IVAC, IVC, IVR, IXYS, JAKK, JASO, JCP, JE, JMBA, JMEI, JMP, KANG, KCG, KEM, KERX, KEYW, KFRC, KGJI, KIN, KIRK, KLIC, KN, KND, KNL, KONA, KOPN, KPTI, KRG, KRNY, KTOS, KTOV, KYE, LADR, LAKE, LAYN, LBAI, LEE, LEJU, LGCY, LIQT, LLEX, LLNW, LMOS, LNTH, LOCO, LPCN, LPG, LPSN, LPTH, LQ, LSCC, LTRPA, LTS, LXFR, LXRX, LXU, OREX, MACK, MAG, MAGS, MARA, MATR, MBI, MCC, MCEP, MCHX, MCRB, MCRN, MDCA, MDXG, MEET, MEIP, MERC, MGI, MGNX, MHLD, MITK, MITL, MIXT, MN, MNKD, MNR, MNTA, MOBL, MOD, MORE, MOSY, MRC, MRCC, MRNS, RKDA, MRTN, MTBC, MTGE, MTOR, MTRX, MTW, MUX, MVIS, MWA, MX, MYOK, NADL, NAK, NAT, NAVB, NCI, NCIT, NCMI, NCS, NCV, NCZ, NDLS, NEO, OHGI, OVAS, TEUM, NEOS, NEOT, NERV, NETE, NEWM, JAG, CEI, MYO, SDRL, SENS, NGD, NGL, NGVC, NIHD, NK, NLS, NLST, NM, NMFC, NMIH, NMM, NNA, NOG, NPTN, NR, NRE, NSM, NSPR, NSU, NVCR, NVDQ, NVGS, NVIV, NVTA, NWBI, NXE, NAUH, NXTD, NYLD, NYMT, NYMX, NYRT, OAS, IDSY, OCLR, OCN, OCUL, OFG, OGEN, OGXI, OMAM, OME, OMED, OMER, ONDK, ONVO, OOMA, OPGN, OPHT, OPTT, OPXA, ORBC, ORC, ORIT, OSG, OSUR, OTIC, OXLC, PBPB, PDLI, PDS, PED, PEI, PEIX, PEO, PES, PETX, PFLT, PGEM, PGH, PGLC, PGNX, PGTI, PHH, PIR, PIRS, PKD, PLAB, PLG, VRAY, PLPM, PLUG, PLX, PMT, PMTS, PNK, PNNT, PPP, PRAN, PRFT, PRMW, PRTO, PRTS, PRTY, PSDV, PSTB, PSTI, PTCT, PTI, PTN, PULM, PVG, PXLW, QSII, QTM, QTNT, QUIK, QUOT, RADA, RAS, RATE, RCII, RDC, RDNT, RDWR, REGI, REI, RELY, RESI, RFP, RGLS, RGS, RGSE, RIC, RIGL, RLGT, RLH, RLOG, RMBS, RMTI, RNN, RNVA, ROX, RPRX, RPT, RPXC, RRD, RRTS, RSO, RSYS, RTIX, RTK, RTRX, RTTR, RUBI, RUN, RVSB, RVT, RWLK, RWT, RXDX, RXII, RYAM, RYI, SA, SAH, SALT, SBLK, SCLN, SCMP, SCS, SCVL, SD, SDLP, SEAS, SFL, SFS, SFUN, SGMO, SGY, SGYP, SHIP, SHLD, SHOR, SIGM, SITO, SJT, SKLN, SM, SMRT, SN, SNCR, SND, SNR, SONS, MNK, SORL, SPEX, SPKE, SPN, SPPI, SPWH, SQBG, SREV, SRI, SRNE, SRT, SSI, SSNI, SSP, SSRI, SSW, STAR, STB, STKL, STML, STNG, STON, STRL, SUP, SVA, SVM, SXC, SXCP, SXE, SYMX, SYN, SYNC, SYNT, TA, TAHO, TAST, TBBK, TCAP, TCCO, TCPC, TCS, TDW, TEDU, TENX, TERP, TESO, TGB, TGH, TGTX, THC, THLD, THM, TICC, TIER, TILE, TIME, TIS, TITN, TK, TLGT, TLRD, TMST, TNDM, TNK, TNP, TOO, NTP, TOUR, TPRE, TRCH, TROX, TRST, TRVN, TRX, TTI, TTMI, TTNP, TTOO, TTPH, TUES, TVPT, TWI, TWNK, TXMD, UAMY, XCO, UCP, UCTT, UIHC, UIS, UMH, UNT, UNXL, URG, URRE, USAC, USAT, UTI, VCEL, VDSI, VG, VGZ, VHC, VICL, VIVO, VJET, VKQ, VLRS, VNCE, VNDA, VNET, VNOM, VOXX, VRA, PACD, VRS, VSAR, VSI, VSLR, VSTM, VTTI, VUZI, VVUS, WAC, WAIR, WATT, WBAI, WDR, WETF, WIFI, WIN, WLB, WLL, WMAR, WMC, WMIH, WMS, WPG, WPRT, WSR, WTI, XCRA, XNET, XTLY, XXII, YRCW, YUME, ZAGG, ZEUS, ZGNX, ZIOP, ZIXI, ZOES, ZSAN, ZUMZ, ZYNE, CTSO, CYRN, DAKT, DELT, DEST, DRAD, DRWI, DWSN, EAD, EDAP, EPM, ERA, ETRM, FAC, FHCO, FNCX, FLDM, FLL, FRSH, FSFR, FSI, GAIN, GARS, GBR, GENE, GFA, GGN, GIFI, GNE, GPRK, GRPN, GSB, GSIT, GSL, GUID, GURE, HGT, HNRG, HPJ, IAG, ICD, IDSA, IID, III, IMDZ, SPI, CFRX, IMMR, IMMY, IMNP, INB, INFU, INVE, IPAS, MSDI, IRIX, ISR, ITI, IVTY, KCAP, KNDI, KODK, KTCC, LBY, LFVN, LQDT, LTBR, LTRX, LUB, LYTS, MCBC, YUMA, MDLY, MBRX, MDR, MGIC, MHH, MICT, MIRN, MNGA, MNTX, MOC, MRIN, MTL, MVF, MXWL, MYOS, NAO, NEPT, NL, NNVC, NRO, NTIP, OHRP, OMN, ONCS, ONTX, ORMP, ORN, ORPN, OTIV, PBT, PER, PFIE, PFMT, PFSW, PLM, PME, PRKR, PTX, PWE, PZN, QNST, PHMD, SGMS, RCON, REFR, RENN, REPH, REXX, ROSG, FENX, SAEX, NAKD, ADMA, BDR, SANW, SAUC, SCON, SDR, SDT, SHOS, SHSP, SIEN, SIFY, SINO, SNAK, SNSS, SPAR, SPCB, SPHS, SSH, SSN, STAA, STAF, STRM, SUMR, SYPR, TANH, TAT, TCON, TCRD, TGA, TGC, TGLS, TISA, TLYS, TNAV, TNXP, TRIL, TRMR, UCFC, UEPS, ULBI, USAK, USEG, UUUU, VBIV, VCYT, VNRX, VOC, VSR, VTL, VTNR, VYGR, WHLR, WILN, STLY, INSG, WSTL, WTT, WYY, XBIT, XGTI, XIN, XPL, XRA, YGE, ZFGN

  • Like 1

Share this post


Link to post
Share on other sites

18, 20    CS0103    The name 'BollingerBands_Top' does not exist in the current context    
24, 20    CS0103    The name 'PriceChannels_Top' does not exist in the current context    
30, 20    CS0103    The name 'PriceChannels_Bottom' does not exist in the current context    
36, 20    CS0103    The name 'BollingerBands_Bottom' does not exist in the current context    
42, 25    CS0103    The name 'VWAP_Line' does not exist in the current context    
48, 25    CS0103    The name 'PriceChannels_Center' does not exist in the current context    
54, 23    CS0103    The name 'FibonacciPivots_Res1' does not exist in the current context    
60, 9    CS0103    The name 'RSI_Line' does not exist in the current context    
72, 9    CS0103    The name 'CCI_Line' does not exist in the current context    
 

Share this post


Link to post
Share on other sites

itsmadvil: note that the variables used in the code FIRST have to be defined in the top table for the advanced code. How to define these was explained in the comments in the code above:

 

// Var Name: "BollingerBands_Top" contains Bollinger Bands(20,2).Top
// Var Name: "PriceChannels_Top" contains Price Channels(20).Top
// Var Name: "PriceChannels_Bottom" contains Price Channels(20).Bottom
// Var Name: "BollingerBands_Bottom" contains Bollinger Bands(20,2).Bottom
// Var Name: "VWAP_Line" contains VWAP (Intraday)().Line
// Var Name: "PriceChannels_Center" contains Price Channels(20).Center
// Var Name: "FibonacciPivots_Res1" contains Fibonacci Pivots (Intraday)(def).Res1
// Var Name: "RSI_Line" contains RSI(20,2).Line
// Var Name: "CCI_Line" contains CCI(14).Line

Share this post


Link to post
Share on other sites

merlin: that's a fairly intense scan - and you're running it on a lot of symbols. Can you tell me what your CPU and memory consumption is when you're running this (and with what feed?)

Share this post


Link to post
Share on other sites
41 minutes ago, Mike Medved said:

merlin: that's a fairly intense scan - and you're running it on a lot of symbols. Can you tell me what your CPU and memory consumption is when you're running this (and with what feed?)

16GB ram, ssd 128 GB,. Usually i scan one portfolio with about 1300 symbols with the yahoo feed and one with a6/10 (watchlist) with IQFEED or IB quotes. At the same time i run TWS (IB), Darwin (Directa), TI (Trade Ideas) , Karspersky (antivirus) and and some browser pages. All is running ok. 

Sometimes the performance suffers if i open too many charts, but usually i'm fine with no more than 3 MT charts. Monday i will run all togheter again and will make some screenshotos with the performance of Mem and pcu usage. (Currently the list is 1407 symbols)

pc specs.png

SCAN Y.png

Edited by merlin8121

Share this post


Link to post
Share on other sites

As i told Jerry time ago, i think the scanner should be modified a little. The same way Multicharts and others are working.

The scanner should have a complete list of symbols (Nyse/nasdaq/Amex) included  and a set of basic filters to  make a fast check (once in a minute?)  to pick the best 50/100 stock matching the basic conditions sets (example performance/volume etc). And automatically generates/filter  a dynamic  watchlist . Once the "dinamyc" WL is generated the scanner applies the scanner/paintbars conditions  made by users.

Hope i explained well :) what i mean. 

The biggest problems at this time is to have in the WL the symbols that are currently moving. The only solution is to make a monster list, but pc performance suffers. This is why  is necessary to find a way for MT to build a WL automatically with the usefull symbols of the day.

Jerry told me that could be an abuse of the datafeed, but perhaps not if the "general scan " is done only one time each minute or two , and only for the basic features (quote, performance, volume). After this "big scan" , MT updates the WL (50/100 symbols) and the scanner continues scanning only those symbols for the next minute or two.

Share this post


Link to post
Share on other sites

Here's the big problem with that idea: the stock data is shared among all windows in MT. That is why it is problematic to have two sources get data for the same symbol - it clashes. In the case you describe, the big port, after it creates the little port, will continue running the scans on the stocks in the little port if the little port is connected to a real time source, and any data that will come in big port will conflict with the data on the same symbol collected by the little port.

But - what we *could* do is allow a button to create a portfolio or a watchlist from the results of a scan on another portfolio - manually. Then you could conceivably open a big portfolio/scan, run that preliminary scan on it, generate another portfolio from it, turn off/close the big portfolio and place whatever scan you want on the newly generated one.

 

Share this post


Link to post
Share on other sites

I think is not needed two sources. Only one.

The idea is in the first place to make a complete scan (for all symbols of nasdaq/Amex/Nyse) to find the 100/200/300 stocks moving at the time (with a predefined parameters as Performance/volume). Once MT find the best candidates it create a list with which will continue running as a scan with the paintbar/scan selected. repeating this every 1/2/3 or 5 min. 

No need to use more than one datasource. For example IB allow 100 symbols (included), Directa 300, IQFEED 500 and so on, at the same time.  If you want i can show how it runs in another platform which use the same datafeeds as MT, via screenshare with Discord, just let me know when you can connect with whats up.

Edited by merlin8121

Share this post


Link to post
Share on other sites

At the moment of the screenshot, i'm using MT with 4 charts, 2 portfolios (one with 1400 symbols runnng the scanner and one with 10 symbols) . TWS (IB) , Discord Kaspersky etc and some browsers windows.  Perfromance is perfect at this moment.

MT Mem cpu.png

Share this post


Link to post
Share on other sites

That's good - but the source is not streaming :) MT only recalculates the scans when new data comes in. If new data comes in 10 times a second, that will eat up CPU. Of course, there are only a few stocks that are that liquid, so...

Share this post


Link to post
Share on other sites
24 minutes ago, Mike Medved said:

That's good - but the source is not streaming :) MT only recalculates the scans when new data comes in. If new data comes in 10 times a second, that will eat up CPU. Of course, there are only a few stocks that are that liquid, so...

The source  for quotes is Yahoo, updated  each second. Not the best but enough to give signals. Why  you think is not streaming?   (in that screenshot i used the filter)

Edited by merlin8121

Share this post


Link to post
Share on other sites
4 minutes ago, Mike Medved said:

I thought it was not streaming (updated every second is "snapshot" not streaming) because you mentioned before you were using Yahoo.

Ah Ok! Well yes , is a snapshot every second. But for the purpose is ok anyway.. If i found  a symbol interesting, i drag it into the second portflio with IB/IQfeed quotes. The scanner works well even with a 1 second "delay" . :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×