StockFetcher Forums · General Discussion · A personal DUHHH! Moment<< >>Post Follow-up
nibor100
1,031 posts
msg #155757
Ignore nibor100
2/14/2021 10:26:54 AM

1. Many times I start writing a filter with lines such as below

Fetcher[
close between 10 and 15

add column volume * price
]



and I get no column with volume times price info but a column with just volume info

2. Then I would revert to writing

Fetcher[
close between 10 and 15

set{var1, volume * price}

add column var1 {volume * price}

]



Which works fine

3. Earlier this week I was researching an issue in the SF user manual and ran across this line

"add column fast stochastic(15) fast %k 1 week high minus the fast stochastic(15) fast %k 1 week low"

and it dawned on me that maybe an Add Column statement can perform math operations in text only forms on 2 indicators/variables so I tried replacing the " * " with "muliplied by'

Fetcher[
close between 10 and 15

add column volume multiplied by price {volume * price}

]



and it worked!

4. Since I already knew that I could use an Add Column statement to combine column data output with "filter by" commands I wrote the following my old way

Fetcher[
close between 10 and 15

set{var1, volume * price} add column var1 {volume * price}

var1 > 300,000,000
]



and then the test filter combining the add column with the filter by statement

Fetcher[
close between 10 and 15

add column volume multiplied by price > 300000000
]



which also worked!

Maybe everybody already knows that we can code this way, but it seems like a mini breakthrough to me that might help reduce some filter complexity issues we occasionally run into.by reducing the total number of set statements used.

Ed S.





Cheese
1,374 posts
msg #155762
Ignore Cheese
2/14/2021 12:13:17 PM

Ed,
Thank you for sharing.
I didn't know this feature.

fotchstecker
304 posts
msg #155850
Ignore fotchstecker
2/17/2021 9:20:38 PM

Good find.

StockFetcher Forums · General Discussion · A personal DUHHH! Moment<< >>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.