StockFetcher Forums · General Discussion · How to code Closing Range<< >>Post Follow-up
moonriding
5 posts
msg #157592
Ignore moonriding
9/17/2021 9:18:38 AM

How do I write a filter for the following condition:

(Close – Low) / (High – Low) is equal to or less than 0.25

[note: 0.25 is 25% expressed in decimal format]

xarlor
581 posts
msg #157593
Ignore xarlor
9/17/2021 9:50:37 AM

Fetcher[
set{x1,close - low}
set{x2,high - low}
set{x3,x1/x2}
x3 <= 0.25

add column x3
]



moonriding
5 posts
msg #157634
Ignore moonriding
9/23/2021 8:15:30 AM

Thank you. I realize the condition I want to create is in the Example Filters "Close in bottom 25% of day range":
Open is below the Day Position(0.25,5)

What I don't understand is why the example used "Open is below" instead of "close is below".

Quoted from the Usage Guide, the Day Range equation is essentially the equation I wanted to use but rearranged: "The Day Position is a basic measure that computes a value that is a percentage of the day range. In other words, if the position parameter is 0.5, the Day Position will be Low + ((High - Low) * 0.5). Any value from 0 to 1 may be used to locate a position within the daily range."

When rearranged and only looking for close in bottom 25% of current day range I got:
Close is below the Day Position(0.25)

Please explain

styliten
297 posts
msg #157635
Ignore styliten
modified
9/23/2021 8:37:35 AM

@moonriding

1. Open, Close, High & Low are reversed words referring to these 4 specific values.

cf. Indicators and Measures · Open, High, Low, Close


2. When you write open/close is below/above day position(0.25), SF will check specific open or close values to see if they meet the criteria "below/above day position(0.25)".


3. Also day position(0.25) = day position(0.25, 5) because by default, the second argument, when omitted, is 5.

cf. Indicators and Measures · Day Position

Note: By default the day position period is 5 days.

which is illustrated in example 1 there, immediately below this note.

moonriding
5 posts
msg #157637
Ignore moonriding
9/23/2021 9:07:39 AM

@styliten

Thank you. I want the filter to show stocks that closed in the bottom 25% of the current day's range. Is this condition correct:

close is below day position(0.25, 1)



styliten
297 posts
msg #157638
Ignore styliten
modified
9/23/2021 9:24:24 AM

@ moonriding

YES, and close < day position(0.25, 1) would work as well.

By extension, close < day position(0.25, 1) 1 day ago will catch those below 25 percentile of yesterday's day range and

count(close < day position(0.25, 1), 10) > 3 will catch all those that have closed below the 25 percentile mark of the daily trading range at least 3 times in the last 10 trading days (inclusive of today).

nibor100
1,031 posts
msg #157640
Ignore nibor100
9/23/2021 9:26:54 AM

@moonriding,

1. Looks like you have found a SF error in that Example you posted as I agree it should state "close" instead of "open".

Hopefully SF support will see your post and correct that example....

2. I suspect you'll find when you use the corrected statement as your filter and compare the results to Xarlor's suggested filter, that Xarlor's filter will return many more stocks than the corrected statement filter.

My initial investigation into that difference in results seems to indicate that SF is doing some kind of rounding on some of the calculations.....but who knows for sure

Hope this helps some,
Ed S.



StockFetcher Forums · General Discussion · How to code Closing Range<< >>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.