StockFetcher Forums · General Discussion · Any good ideas to search for certain patterns like this?<< >>Post Follow-up
styliten
294 posts
msg #154863
Ignore styliten
modified
12/9/2020 6:32:06 PM

Fetcher[symlist(YETI, DY)

chart-time is 30 days
]



YETI-DY

The specific pattern I am looking for is this:

1. day change for today > 3%
2. but some time prior to today there were some down days, i.e., day change < -2.5% (if day change was somewhere between -2.5% and 2.5% consider that price neutral). Tally the total # of such consecutive down days (where day change < -2.5%).
3. Then look further back (up to the past 30 days including today) and tally the total # of down days (using the same day change < -2.5% criteria) in the prior down cycle.

Show only the stocks where the loss stretch was longer in the prior down cycle rather than the most recent one

In the specific examples of YETI and DY, the most recent loss stretch on both is only 1 (the actual day change on these specific down days may or may not hit the -2.5% benchmark, but I am only use these 2 tickers for illustration purposes), but during the prior loss stretch, YETI had 2 and DY had 4. Because prior loss stretches were longer than the most recent one (in terms of # of consecutive loss days), I want to review them to see if any stocks exhibiting such price move patterns might be on the verge for a breakout.

Is this filter possible with SF built-in syntax?

Share your wisdom please.

Cheese
1,374 posts
msg #154865
Ignore Cheese
12/9/2020 8:24:04 PM

Have you tried
https://www.stockfetcher.com/sf/symcompare.php?days=90&sym=YETI
https://www.stockfetcher.com/sf/symcompare.php?days=90&sym=DY

styliten
294 posts
msg #154867
Ignore styliten
12/9/2020 8:44:44 PM

Yes I’ve used that option from time to time. But I’m still interested to know whether any such patterns, however visually defined first, can be crafted into a SF filter using the standard SF syntax. Then I can sort/rank results. So I’m brain picking here.

Cheese
1,374 posts
msg #154873
Ignore Cheese
12/10/2020 10:34:21 AM

I don't have a solution.

But somehow this reminded me of I kossvet's also fairly specific request a while ago.
xarlor's help to kossvet spanned 3 threads.
Apparently, both xarlor and kossvet have made some profits from some versions of the filters.

If xarlor doesn't take up on your request above, perhaps you could review xarlor's and kossvet's posts.

kossvet did make clear that those filters were about medical stocks and he has expertise in those fields.

styliten
294 posts
msg #154875
Ignore styliten
modified
12/10/2020 10:46:00 AM

@Cheese,

I kinda of know this wouldn't be possible within the current SF syntax because it basically involves countif/sumif/recursive/looping....Because this kind of looping takes a lot of computing power, it probably requires a lot of investment than SF is willing to make.

Heikin-Ashi, the alternative to the standard candlestick, is the same story. It requires a recursive calculation and SF never bothered to implement that (as a very simple and practical way to filter out some noise).

Another less traveled road is "Triangular Moving Average":

https://www.stockfetcher.com/forums/Filter-Exchange/Triangular-Moving-Averages/131401/-1/131401

Very very brilliant idea indeed, possibly a very good contender for/alternative to Hull Moving Average and/or Linear Regression/Time Series Forecast.

But judging from the original post that referenced TMA, it's easy to see the inclusion of TMA in SF's arsenal requires a LOT of computing. For example, TMA(200) would need to do some 201 additions, not to mention that each of the MAs underneath has to be calculated first and then stored somewhere in the memory until TMA is finally calculated. And once people have TMA, they would naturally want native support for TEMA using EMAs as the backbone.

Cheese
1,374 posts
msg #154876
Ignore Cheese
12/10/2020 11:01:34 AM

Thanks for the TMA, sty

xarlor
581 posts
msg #154897
Ignore xarlor
modified
12/11/2020 10:43:10 AM

This is the best approach I could think of, styliten. A bit of explanation is in order.

This attempts to give you a visual of how many times, within the last 3 days, day change was -2.5% or worse.

1of3downdays means only 1 day of the last 3 days was the day change -2.5% or worse.
2of3downdays means 2 of the last 3 days the day change was -2.5% or worse.
3of3downdays means all 3 of the last 3 days the day change was -2.5% or worse.

Looking at all 3 variables above, the combined visual pattern you're looking for is a "V". From there, you can browse to the right and see how many consecutive -2.5% down-days happened. A "U" pattern indicates more than 3 consecutive down-days.

Of note, your examples fail the -2.5% criteria.
YETI's first 2 downdays are -1.73% and -2.38% while the stand-alone downday was -2.61.
DY's first 4 downdays are -3.86%, -2.44%, -1.41%, and -0.02% while the stand-alone downday was -1.20%.

My definition of day change uses the day's open and the day's close. If you want it to be yesterday's close to today's close, replace the pdiff1 with the commented out one. Using that method still doesn't satisfy the criteria for YETI and DY, however.

Lastly, I included only optionable stocks to reduce the universe to "serious" stocks only. YMMV.

Fetcher[
chart-time 30 days
optionable

/* If day change should be calculated using yesterday's close to today's close, replace the pdiff1 line with this one:
set{pdiff1,close / close 1 day ago}
*/
set{pdiff1,close / open}
set{pdiff2,pdiff1 - 1}
set{pdiff,pdiff2 * 100}

pdiff > 3

set{hits,count(pdiff < -2.5,3)}
set{triggers,count(hits > 2,30)}
triggers > 0

set{1of3downdays,count(hits equals 1,1)}
draw 1of3downdays
plottype{1of3downdays,zerobar}

set{2of3downdays,count(hits equals 2,1)}
draw 2of3downdays
plottype{2of3downdays,zerobar}

set{3of3downdays,count(hits equals 3,1)}
draw 3of3downdays
plottype{3of3downdays,zerobar}

add column pdiff
do not draw pdiff
do not draw triggers
]



styliten
294 posts
msg #154915
Ignore styliten
modified
12/12/2020 12:35:16 PM

@xarlor

I'm truly amazed by your ability to think out of the box. Certainly a very worthwhile alternative to the original question. Just wonder if you are some kind of computer wiz in real life.

On a different note, have you ever branched out far into the DMA (displaced MA)? Do you see any potential to employ DMA for maximum effect?

I've experimented a lot of different combinations of linear regression, time series, Fischer transform and Inverse FT or even T3 moving avg, etc. etc., I've gradually come to the conclusions based on personal observations:

a. the 80/20 rule almost always holds out true, meaning if you buy a basket of 10~15 individual stocks and hold it for as brief as 10~15 trading days then check the results, you'll see 80/20 worked out almost like a miracle; this has certainly led to the strong suggestion that our world is somehow preprogrammed with the parameters set in advance although the success or failure of each individual stock seems to be randomlike

b. as far as the efficiency/accuracy of individual indicator goes, it seems that accuracy and timeliness are almost always canceling each other out, the improvement of one is almost always at the expense of another. They just refuse to marry each other!

xarlor
581 posts
msg #154947
Ignore xarlor
12/14/2020 11:08:06 AM

@styliten I am in the I.T. field, though not a programmer. I dabble in coding, though, and am always frustrated by not having the ability of some basic functions on SF, like loops, nested IFs, variable recall of days, and more. Makes for some inventive solutions at times.

I've looked into DMA, tried making some filters, but none of them ever panned out. The problem I have with DMA is it's based off a lagging indicator already. When trying to use positive DMA, you're making it lag even further. When using negative DMA, you're attempting to predict an average off data that is not even current, in other words, data that is already lagging behind. Add in that the value changes day-to-day as the new MA is known and it's just not reliable at all.

But as I often preach, if you find something that works for you and is profitable for you, then keep using it! It's not the filter, it's how you trade.

styliten
294 posts
msg #154950
Ignore styliten
modified
12/14/2020 3:57:34 PM

@xarlor

Once again, appreciate your honesty.

Try adding DMA(9, 3) & DMA(9, -3) & DMA(9,0) in the same filter, and see what you think.

PS
(Don't jump off the bridge just yet.)

StockFetcher Forums · General Discussion · Any good ideas to search for certain patterns like this?<< >>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.