StockFetcher Forums · General Discussion · How can I change this Guppy filter to avoid performance restrictions?<< >>Post Follow-up
KennyJ
3 posts
msg #155986
Ignore KennyJ
3/1/2021 2:05:00 AM

The following filter should find a stock that has a very compressed Trader group within the past 3 days.
Unfortunately when I include the "within the last 3 days" clause, StockFetcher returns an error message regarding performance restrictions.

Any suggestions for rewriting this to avoid that error?

Thanks,
-Ken

Fetcher[market not etf

symlist(sq)

beta > 0

ema(30) > ema(35) > ema(40) > ema(45) > ema(50) > ema(60)
do not draw ema(30)
do not draw ema(35)
do not draw ema(40)
do not draw ema(45)
do not draw ema(50)
do not draw ema(60)

draw ema(3)
draw ema(5)
draw ema(7)
draw ema(9)
draw ema(11)
draw ema(13)

/* TRADER GROUP WIDTH */
/* find the ema of the top line */
set{l_top1, max(ema(3) , ema(3))}
set{l_top2, max(ema(7) , ema(9))}
set{l_top3, max(ema(11), ema(13))}
set{l_top4, max(l_top1 , l_top2)}
set{l_top , max(l_top3 , l_top4)}

/* find the ema of the bottom line */
set{l_bot1, min(ema(3) , ema(5))}
set{l_bot2, min(ema(7) , ema(9))}
set{l_bot3, min(ema(11), ema(13))}
set{l_bot4, min(l_bot1 , l_bot2)}
set{l_bot , min(l_bot3 , l_bot4)}

set{l_width, l_top - l_bot}

/* this works */
l_width is less than 20

/* this results in performance restrictions */
/*
l_width is less than 20 within the last 3 days
*/
]



graftonian
1,089 posts
msg #155988
Ignore graftonian
3/1/2021 9:11:06 AM

@Ken,
I ran your filter without problems, nice job. But, many filters I have written cannot be run by other users. The consensus has been the need for an advanced subscription, however I DO NOT have an advanced sub.
Keep the new ideas coming,
Graf

compound_gains
222 posts
msg #155991
Ignore compound_gains
3/1/2021 11:44:42 AM

You could try...

count(l_width below 20,3) above 0

...to see if that makes any difference

nibor100
1,045 posts
msg #155995
Ignore nibor100
3/1/2021 5:24:21 PM

@KennyJ,

1. I believe you left off an EMA(5) in your set of I_top statements.

2. I opened up another browser in windows that had no knowledge of my advanced subscription and I was able to run it without performance restrictions with your problem line activated.

However, if I comment out your symlist line it will not run due to performance restrictions. I'm guessing that multiple passes thru the logic of your entire filter either over a number of days and/or a number of stocks is the source of the performance problem.

3. Under my advanced subscription, it returns 4,055 stocks, using that problem line.

Being curious I added 3 columns: add column l_width, add column l_width 1 day ago, add column l_width 2 days ago,.to see how large that value might be on the other days that the value doesn't have to be below 20.

I was surprised that none of the 3 columns had values > 20, when I sorted each descending, which seems to me that SF is forcing results to be limited to all 3 days having a value lower than 20 which I was not expecting.

I was expecting cases where 2 days ago the width might be 22, 1 day ago 21, and today 19.5 but clearly I was wrong about that.

Just some ramblings,
Ed S.





lis
37 posts
msg #156069
Ignore lis
3/8/2021 6:00:24 PM

When I get the performance error, I just repeat the fetch. It usually works on the 2nd try. Sometimes, I'll have to wait a minute or two, then try again a couple of times.

I think that if you have the free or basic subscription, they place a timeout on script execution. If you have an advanced subscription, they let your scripts run without any timeout restriction. So, it's more about whether their current server load will allow the script to run within a particular time, and less about the script's complexity; with an advanced subscription, you're helping to support the load, so they turn the timeout setting off.

***** Start of sales pitch...
Of course, keeping our code clean and efficient - as well as signing up for the advanced subscription - helps SF to keep providing us this awesome service!
***** End of sales pitch...

nibor100
1,045 posts
msg #156121
Ignore nibor100
3/12/2021 11:59:35 AM

@lis,

Your timeout notion for basic/free subscriptions, seems like it could be the correct explanation of past instances of some users being able to overcome a complexity warning from SF by just running it 1 or 2 more times.

However, having the advanced subscription I clearly do run into complexity issues stopping my filters from running until I start removing stuff.

Thanks,
Ed S.

lis
37 posts
msg #156126
Ignore lis
3/12/2021 2:53:38 PM

Wow, Ed. I wouldn't have seen that coming! The advanced subscription includes Advanced Filter Support, which, according to SF support, is supposed to allow "complex" scripts. I guess you must have some seriously nested variables and/or indicator combinations that even negates the Advanced Filter Support!

Having acknowledged that, I still see no reason why @KennyJ's script should fail just for adding the phrase "within the last 3 days". I wouldn't have considered that a "complex" feature; though, I suppose, it does require a loop of some sort.

To @KennyJ:

I tried it by breaking out the "within the last 3 days" to a check on the last 3 days, and it didn't give me the performance message:

Fetcher[
market not etf

symlist(sq)

beta > 0

ema(30) > ema(35) > ema(40) > ema(45) > ema(50) > ema(60)
do not draw ema(30)
do not draw ema(35)
do not draw ema(40)
do not draw ema(45)
do not draw ema(50)
do not draw ema(60)

draw ema(3)
draw ema(5)
draw ema(7)
draw ema(9)
draw ema(11)
draw ema(13)

/* TRADER GROUP WIDTH */
/* find the ema of the top line */
set{l_top1, max(ema(3) , ema(3))}
set{l_top2, max(ema(7) , ema(9))}
set{l_top3, max(ema(11), ema(13))}
set{l_top4, max(l_top1 , l_top2)}
set{l_top , max(l_top3 , l_top4)}

/* find the ema of the bottom line */
set{l_bot1, min(ema(3) , ema(5))}
set{l_bot2, min(ema(7) , ema(9))}
set{l_bot3, min(ema(11), ema(13))}
set{l_bot4, min(l_bot1 , l_bot2)}
set{l_bot , min(l_bot3 , l_bot4)}

set{l_width, l_top - l_bot}

/* this works */
/* broke it out into today (0 - no index needed), the day before (1), and the day before that (2) */
l_width is less than 20
l_width[1] is less than 20
l_width[2] is less than 20

/* this results in performance restrictions */

/* l_width is less than 20 within the last 3 days */
]



StockFetcher Forums · General Discussion · How can I change this Guppy filter to avoid performance restrictions?<< >>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.