StockFetcher Forums · Filter Exchange · Can Someone Write a Filter for me Please?<< >>Post Follow-up
karennma
8,057 posts
msg #129047
Ignore karennma
6/9/2016 10:03:48 PM

What's the Boolean for this ... please?
Let's say I have 5 columns (in my filter results): s1, s2, s3, s4, s5
How do I tell SF to add >>> s1 + s2 +s3 + s4 + s5, then /5 to give me an average?
Then add the average as column s6.

Thanks in advance.





graftonian
1,089 posts
msg #129072
Ignore graftonian
6/10/2016 1:13:13 PM

This is the only way to accomplish summing of columns (that ol' 1 math function per set statement).
I keep the code below in MS Word, and use find and replace to modify it to suit. The code, as written return average of open, high, low, and close.
Good luck, and happy week-end.
Fetcher[
set{s1, high}
set{s2, low}
set{s3, open}
set{s4, close}
/*now add*/
set{sum2, s1 + s2}
set{sum3, sum2 + s3}
set{sum4, sum3 + s4}
/*now average*/
set{avg, sum4 / 4}
add column avg
sort on column 5 descending
]



karennma
8,057 posts
msg #129080
Ignore karennma
modified
6/11/2016 8:18:20 AM

Hi graftonian,
Thanks for helping me.
My apologies for neglecting to mention this before, but ....
I just noticed the problem is, when the results appear in the columns, they have brackets (in "table" mode").
So, [1] is rsi 1 day ago, [2] is rsi 2 days ago and so on.
I think, somehow, the filter must be written with the brackets? (I tried already.)
For simplicity's sake, we'll use one stock
i.e, -- run this, and you'll see ...

Fetcher[
symlist(V)
add column rsi(14) 1 day ago
add column rsi(14) 2 days ago
add column rsi(14) 3 days ago
add column rsi(14) 4 days ago
]




The average rsi(14) would be 63.04.



graftonian
1,089 posts
msg #129082
Ignore graftonian
modified
6/11/2016 11:13:28 AM

Karen, I think the brackets are a "shorthand" method of displaying "x days ago"
Using SET statements eliminate the brackets
Fetcher[
add column rsi(14) 2 days ago
/*or*/
set{rsi14_2, rsi(14) 2 days ago}
add column rsi14_2
]


Does this make any sense?

StockFetcher Forums · Filter Exchange · Can Someone Write a Filter for me Please?<< >>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.