StockFetcher Forums · General Discussion · "within time" not working...<< >>Post Follow-up
kbadeau
2 posts
msg #157706
Ignore kbadeau
9/30/2021 4:05:42 AM

Hello folks,

Looking for some basic help using the "within" filter.

On a filter line such as:
XXX is below -1 within the last 2 weeks

I am able to see clearly that this is true for a given stock and if I remove the "within" clause and use the scroll back feature going back one day at a time in the filter dialog I can see my stock eventually meets the criteria by clicking back just a few days (i.e. less than 2 weeks).

However, if I add the "within the last 2 weeks" criteria the stock does not appear as meeting the criteria.

For a particular example I am working with the MACD and trying to flag stocks where the Fast Line was below -1

In my script below I am using the stock BERY as it met the "below -1" criteria on Sep 22, 2021, which at time of writing on Sep 30, was just about 8 days ago (or less in trading days).

If I use the below without the "within 2 weeks" filter and scroll back to Sep 22 the stock appears in the results. If I use that "within 2 weeks" filter as of today, Sep 30, the stock does not appear to meet the filter's criteria.

Note: in my example I am using some user defined variables and displaying them as columns so I can see exactly what the values are for Fast, Slow, and Divergence for each day.

I am using the variable in my criteria line but I've tried this with the basic function itself and also not having any luck, thus why I started using the variables so I could see for myself what the values really are.

Any help is much appreciated!

------------------
apply to symlist(BERY)

set{Divergence,MACD Histogram(8,16)}
add column Divergence

set{MyDiv,MACD Fast Line(8,16,11) - MACD Slow Line(8,16,11)}
add column MyDiv

set{MyMFL,MACD Fast Line(8,16,11)}
add column MyMFL

set{MyMSL,MACD Slow Line(8,16,11)}
add column MyMSL

draw MACD Fast Line(8,16,11)
MyMFL is below -1 within the last 2 weeks

redversa721
157 posts
msg #157707
Ignore redversa721
9/30/2021 8:51:22 AM

Could you try using IN instead of within

nibor100
1,031 posts
msg #157710
Ignore nibor100
9/30/2021 10:53:11 AM

@kbadeau,

The following should work for you:

MyMFL crossed below -1 within the last 2 weeks

My guess is by replacing "is" with "crossed" SF understands it to be more of a temporary occurrence as opposed to a more permanent status.

Which probably explains why when you went back to the actual day without the "within" it returns a result for that date....but this is only a guess on my part as nuances of SFs language and syntax processing occasionally create quite the mystery.

Hope this helps,
Ed S.



kbadeau
2 posts
msg #157712
Ignore kbadeau
9/30/2021 11:35:03 AM

@redversa721
Thanks for the reply. That still wasn't quite working.

@nibor100
Thanks for the reply also. That actually seems to be working!

If I play with something like:
MyMFL crossed below -1 within the last 2 days
and keep increasing by 1 (via manually changing the number in the filter) the number of days to look back until I hit 8 then suddenly the filter reveals that stock so it seems to be applying the criteria nicely to the look back window specified.

Thanks so much!



StockFetcher Forums · General Discussion · "within time" not working...<< >>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.