StockFetcher Forums · General Discussion · Column confusion<< >>Post Follow-up
sunspore
22 posts
msg #161673
Ignore sunspore
3/12/2025 3:56:20 PM

Hi, I'm trying to figure out why SF is re-labeling a user function on one of my columns, and also why the values within the column are all "0". Here is a snippet of the code, and I apologize that I don't know how to format this as code within this post (would appreciate a tip there, too):


^EMA(9) < EMA(20)
EMA(20) < EMA(20) 10 days ago
EMA(20) < MA(50)
Close < EMA(20)

set{RelStr, relative strength(SPY, 10)}

add column RelStr
Add column NVlty
add column ATR_Perc
Add column average day range(20)^


The RelStr function keeps being displayed as "Comparative Relative Strength(^IXIC, 30)", and all the values in the column are 0. I have no idea where it's getting that title from.



TheRumpledOne
6,499 posts
msg #161677
Ignore TheRumpledOne
modified
3/13/2025 9:26:52 AM

Fetcher[

set{RelStr, relative strength(SPY, 10)}

add column RelStr

close between 10 and 100

]



wantonellis
163 posts
msg #161678
Ignore wantonellis
3/13/2025 9:59:10 AM

This format works - add column relative strength(SPY, 10) {RelStr}

+ degug your filter. You have errors.

sunspore
22 posts
msg #161691
Ignore sunspore
3/14/2025 4:06:31 PM

Thanks @wantonellis, worked like a charm!

nibor100
1,068 posts
msg #161693
Ignore nibor100
3/15/2025 3:14:47 AM

@sunspore,

If you go to the indicators forum you'll find SF's description of "Comparative Relative Strength" however you won't find in that definition, SF's shortcut phrase for relative strength, which is "relstr(symbol,x) which turns out to be the name you chose for your variable.

When SF parsed your filter it ignored your set statement as being illegally using a command name as a user variable name and when you used that name in your Add column statement it understood it to mean calculate relative strength of something so it defaulted to its stored example value using ^ixic,30.

Since SF no longer recognized ^ixic as a valid index name the result of the relative strength comparison for each stock was 0.

I modified your filter below to show examples of all of those instances.
Ed S.

Fetcher[
^EMA(9) < EMA(20)
EMA(20) < EMA(20) 10 days ago
EMA(20) < MA(50)
Close < EMA(20)

set{Rer, relative strength(SPY, 10)}
add column rer
add column RelStr(spy,10)
add column relstr
Add column NVlty
add column ATR_Perc
Add column average day range(20)^
]



sunspore
22 posts
msg #161700
Ignore sunspore
3/15/2025 10:15:09 PM

@nibor100 Thanks for the detailed response. It makes more sense now. I can't believe I chose that variable name!
When I read the user guide for SF, and then I look at some of the scripts people are writing here, I feel like I'm missing something. The complexity I see in some code here seems to be way beyond what the guide offers. I wonder if I'm missing other resources, or if it just takes a lot more experience to understand how to construct more complicated ideas. Any guidance would be appreciated.

nibor100
1,068 posts
msg #161701
Ignore nibor100
3/15/2025 11:39:45 PM

There is another thread in this forum on what hav we learned about filter writing where I posted a bunch of resources that are in addition to the manual.
But the fastest way to get coding right is to take your best shot, then post it and a description and example of the result you are trying to achieve and usually help comes fairly quickly.
Ed S

sunspore
22 posts
msg #161711
Ignore sunspore
3/17/2025 8:41:57 AM

@nibor100 Thank you Ed, I appreciate the feedback.

StockFetcher Forums · General Discussion · Column confusion<< >>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.