StockFetcher Forums · General Discussion · How to code finding last week's high?<< >>Post Follow-up
meatyboy
8 posts
msg #155967
Ignore meatyboy
2/26/2021 1:38:18 AM

I'm trying to build a scan based off of the Last Stoachastic technique and I'm running into an issue with the look back period. The system is the K%(39) crosses above 50 and today's close is above the high of last week. I'm having an issue getting SF to understand the last bit about the price being above last week's high. Any help would be appreciated.

Fetcher[
/*Last Stochastic scan built by Meatyboy*/
/*Trying to build a Last Stochastic scan*/
market is not OTCBB
Market is not ETF
Average Volume(50) > 1,000,000
Chart-length is 4 month
Fast Stochastics Fast %K(39) crosses above 50

/*Only solution I could come up with for today's price being higher than last week's price but doesn't seem to work*/
Close < high 1 week close


set{var1, CMA(OBV,30)}
OBV is above var1
]



nibor100
1,031 posts
msg #155969
Ignore nibor100
2/26/2021 5:26:37 AM

The following line might get you what you want:

Close < weekly high 1 week ago add column weekly high add column weekly high 1 week ago

Ed S.

lis
37 posts
msg #156071
Ignore lis
3/9/2021 10:20:49 AM

How about this:

1st, proof of concept that we're getting the high close value that you want:

Fetcher[
/* proof of concept: weekly high last *trading* week */
show stocks where chart-time is 2 weeks /* ie, 10 trading days */
and sort by column 2 descending /* sorts by high to low price */

/* the meat:
* if today is Tuesday, then the last trading week ended 2 days ago */
and add column 1 week high 2 days ago
and draw price line at 1 week high 2 days ago

/* hovering over the points on the chart, you'll see the dates the high was hit
* to confirm you're seeing the high for the last trading week */
]



If that's what you're looking for, then add the screen...

Fetcher[
show stocks where chart-time is 2 weeks
and sort by column 2 descending
and add column 1 week high 2 days ago
and draw price line at 1 week high 2 days ago

/* the meat... */
and close < 1 week high 2 days ago
]




lis
37 posts
msg #156072
Ignore lis
3/9/2021 10:22:28 AM

Oops, reversed your close requirement, lol. Still works the same, of course; just switch the little angle bracket thingy to point the other way, DUH ;)

StockFetcher Forums · General Discussion · How to code finding last week's high?<< >>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.