StockFetcher Forums · General Discussion · You guys have come to the rescue before, hopefully again.<< >>Post Follow-up
wallybaby
9 posts
msg #156809
Ignore wallybaby
5/15/2021 11:54:14 AM


Hello, I am trying to get this to work.
I am looking to create filter that will
find the midpoint of each days range for the last 5 days
and then add them together and divide by 5 to get a 5 day average of the midpoint
and then subtracting the 5 day average of the midpoint from the close of the day
and then divide that by atr(5)
and then divide that by 5 ( this results in answer step6 which presents a performance issue SOME of the time)
and then filtering step6 for results less than -.4 so that the answer can be plotted and then

I would like to put in a "count" function so that all instances of this occurring can be highlighted.
Ideally I would like to leave step6 in but it sometimes puts me over the edge on performance issues with sf so I can leave that out, unless with tighter code, it passes.

I posted below what I could do, and am stuck, and I am sure there is an easier way to find this.

thanks in advance for any help.

Fetcher[
optionable
close > 5
and close < 7


/*
finds midpoint of last 4 days plus today
*/
set{day0con,high + low}
set{day0,day0con / 2}

set{day1con,high 1 day ago + low 1 day ago}
set{day1,day1con / 2}

set{day2con,high 2 day ago + low 2 days ago}
set{day2,day2con / 2}

set{day3con,high 3 days ago + low 3 days ago}
set{day3,day3con / 2}

set{day4con,high 4 days ago + low 4 days ago}
set{day4,day4con / 2}


/* sums the totals of the midpoints and divides by 5 days which is called daytotal*/
set{step1,day0 + day1}
set{step2,step1 + day2}
set{step3,step2 + day3}
set{5daytotal,step3 + day4}
set{daytotal, 5daytotal divided by 5}

/* this subtracts the daytotal calc from the close of each day*/
set{step4,close - daytotal}

set{step5,step4 divided by ATR(5)

/*the next line is remmed out see note regarding step6*/
/*set{step6,step5 divided by 5}*/

/* I put these in for debugging purposes*/
and add column step6
and add column step4
and add column step5
and add column ATR(5)

/* and then do a count statement here*/

]



wantonellis
155 posts
msg #156811
Ignore wantonellis
5/15/2021 3:03:11 PM

Fetcher[
close is between 5 and 7
set{midpoint,day range divided by 2}
set{midpoint_sum, sum(midpoint,5)}
set{midpoint_avg, midpoint_sum divided by 5}
set{step4, close minus midpoint_avg}
set{step5, step4 divided by atr(5)}
set{step6, step5 divided by 5}
step6 < -0.4
]



wallybaby
9 posts
msg #156823
Ignore wallybaby
5/17/2021 10:02:34 AM

Thanks!! That " day range " command is new to me.



StockFetcher Forums · General Discussion · You guys have come to the rescue before, hopefully again.<< >>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.