StockFetcher Forums · Filter Exchange · Need help, should be simple<< >>Post Follow-up
testplay
7 posts
msg #151273
Ignore testplay
3/18/2020 12:17:01 PM

I would like to add two columns that show the difference between the 52 week high and the current price. Shown in dollars and in %.

I can't seem to code it.

xarlor
562 posts
msg #151277
Ignore xarlor
3/18/2020 5:27:24 PM

Here you go. For future reference, I do suggest you post whatever code you have. Even if it's not working, it's often helpful to learn how to change your own code to make it work.

Fetcher[
set{52wh,high 52-week high}
set{cls,close}
set{var1,52wh - cls}
set{var2,cls / 52wh}
set{var3,var2 - 1}
set{var4,var3 * 100}

add column var1 {52-week high - close}
add column var4 {Percentage difference}

add column high 52-week high
draw price line at 52wh
]



karennma
8,057 posts
msg #151281
Ignore karennma
3/18/2020 8:17:43 PM

Brilliant!


testplay
7 posts
msg #151285
Ignore testplay
3/19/2020 11:12:12 AM

Thank you xarlor for all the time you put into this..

That's is exactly what I wanted

testplay
7 posts
msg #151286
Ignore testplay
3/19/2020 11:20:43 AM

Xarlor.

If you are interested, this is what I have done with your code. I'm following mostly income funds. Some codes are stolen from others on this site and put together here.

chart-type is ohlc
and chart-display is weekly
apply to symlist (ddf,scd,gab,ety,htd,asg,eos,nie,jtd,jce,zf,dnp,usa,sphd,csq,tpz,fei,fen,bui,inf,utg,utf,duk,bhk,qlta,govt,dfp,flc,ztr,mci,kio,hps,pfn,pcm,jps,hyi,hix,ra,ladr,jrs,rnp,rfi,mitt,nrz,cim,bto,mgu,bcv,avk,stk,govt,bpy,upro,td,bmo,spy,ewc)

Show stocks where close is more than 50% below 52 week high


add column Average Day Range(30)
add column annual dividend yield
add column weekly stochastic (14,3,3)%k
and add column sector and add column industry



Set{cntcmadma1abovecmadma7,count( cma(DMA(7,-5),2) > cma(DMA(7,-5),7) ,1)}
draw cntcmadma1abovecmadma7

Set{cntcmadma1abovecmadma7b,count( cma(DMA(7,-5),2)< cma(DMA(7,-5),7) ,1)}

draw cntcmadma1abovecmadma7b

/* AxA is number of consecutive days cma(DMA(7,-5),1) above (+)/below(-) previous cma(DMA(7,-5),8) */
set{AAb,days( cma(DMA(7,-5),2) is above cma(DMA(7,-5),7) ,250)}
set{AAa,days( cma(DMA(7,-5),2) is below cma(DMA(7,-5),7) ,250)}
set{dmax7, AAa - AAb} and add column dmax7 {dma_x_1over7}
do not Draw AxA


Set{cntcmadma7abovecmadma7,count( cma(DMA(7,-5),7) > cma(DMA(7,-5),7) 1day ago,1)}
draw cntcmadma7abovecmadma7

Set{cntcmadma7abovecmadma7b,count( cma(DMA(7,-5),7)< cma(DMA(7,-5),7) 1day ago,1)}

draw cntcmadma7abovecmadma7b

set{E3,dma(7,-5),7)-cma(DMA(7,-5),7) }
set{Fastdma7Longposition, count(E3 > 0,1)}
set{Fastdma7Shortposition, count(E3 < 0,1)}
SET{TRIGGER,0}
draw Fastdma7Longposition on plot
draw Fastdma7Shortposition on plot
draw cma(DMA(7,-5),2)
draw cma(DMA(7,-5),7)


do not draw dma(7,-5),7)
Chart-time is 12 months

set{52wh,high 52-week high}
set{cls,close}
set{var1,52wh - cls}
set{var2,cls / 52wh}
set{var3,var2 - 1}
set{var4,var3 * 100}

add column var1 {52-week high - close}
add column var4 {Percentage difference}

add column high 52-week high

JoeyVinyl
125 posts
msg #151288
Ignore JoeyVinyl
3/19/2020 1:00:07 PM

Made clickable and took out extra blank lines.

Fetcher[
chart-type is ohlc
and chart-display is weekly
apply to symlist (ddf,scd,gab,ety,htd,asg,eos,nie,jtd,jce,zf,dnp,usa,sphd,csq,tpz,fei,fen,bui,inf,utg,utf,duk,bhk,qlta,govt,dfp,flc,ztr,mci,kio,hps,pfn,pcm,jps,hyi,hix,ra,ladr,jrs,rnp,rfi,mitt,nrz,cim,bto,mgu,bcv,avk,stk,govt,bpy,upro,td,bmo,spy,ewc)

Show stocks where close is more than 50% below 52 week high

add column Average Day Range(30)
add column annual dividend yield
add column weekly stochastic (14,3,3)%k
and add column sector and add column industry

Set{cntcmadma1abovecmadma7,count( cma(DMA(7,-5),2) > cma(DMA(7,-5),7) ,1)}
draw cntcmadma1abovecmadma7

Set{cntcmadma1abovecmadma7b,count( cma(DMA(7,-5),2)< cma(DMA(7,-5),7) ,1)}

draw cntcmadma1abovecmadma7b

/* AxA is number of consecutive days cma(DMA(7,-5),1) above (+)/below(-) previous cma(DMA(7,-5),8) */
set{AAb,days( cma(DMA(7,-5),2) is above cma(DMA(7,-5),7) ,250)}
set{AAa,days( cma(DMA(7,-5),2) is below cma(DMA(7,-5),7) ,250)}
set{dmax7, AAa - AAb} and add column dmax7 {dma_x_1over7}
do not Draw AxA

Set{cntcmadma7abovecmadma7,count( cma(DMA(7,-5),7) > cma(DMA(7,-5),7) 1day ago,1)}
draw cntcmadma7abovecmadma7

Set{cntcmadma7abovecmadma7b,count( cma(DMA(7,-5),7)< cma(DMA(7,-5),7) 1day ago,1)}

draw cntcmadma7abovecmadma7b

set{E3,dma(7,-5),7)-cma(DMA(7,-5),7) }
set{Fastdma7Longposition, count(E3 > 0,1)}
set{Fastdma7Shortposition, count(E3 < 0,1)}
SET{TRIGGER,0}
draw Fastdma7Longposition on plot
draw Fastdma7Shortposition on plot
draw cma(DMA(7,-5),2)
draw cma(DMA(7,-5),7)

do not draw dma(7,-5),7)
Chart-time is 12 months

set{52wh,high 52-week high}
set{cls,close}
set{var1,52wh - cls}
set{var2,cls / 52wh}
set{var3,var2 - 1}
set{var4,var3 * 100}

add column var1 {52-week high - close}
add column var4 {Percentage difference}

add column high 52-week high
]



StockFetcher Forums · Filter Exchange · Need help, should be simple<< >>Post Follow-up

*** Disclaimer *** StockFetcher.com does not endorse or suggest any of the securities which are returned in any of the searches or filters. They are provided purely for informational and research purposes. StockFetcher.com does not recommend particular securities. StockFetcher.com, Vestyl Software, L.L.C. and involved content providers shall not be liable for any errors or delays in the content, or for any actions taken based on the content.


Copyright 2022 - Vestyl Software L.L.C.Terms of Service | License | Questions or comments? Contact Us
EOD Data sources: DDFPlus & CSI Data Quotes delayed during active market hours. Delay times are at least 15 mins for NASDAQ, 20 mins for NYSE and Amex. Delayed intraday data provided by DDFPlus


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.