StockFetcher Forums · General Discussion · Loops<< >>Post Follow-up
fokane
74 posts
msg #58694
Ignore fokane
1/2/2008 11:43:53 AM

Anyone familiar with programming langauges, C, Java etc. will know about for(), while() loops.
Is there a way to do this in SF?

I can do it manually by copy-pasting in the code for each iteration but it would be easier to just have this once in the program and run it each time in the loop.
The filter should return all results for each iteration of the loop.

nikoschopen
2,824 posts
msg #58716
Ignore nikoschopen
1/2/2008 10:33:17 PM

If I had more time, which I do, I would rather look at more charts than to decipher codes, but technically you could use the count() function to achieve the loop, no? Or something along that line.

for ( int x = 0; x < 10; x++ ) // The loop goes while x < 10, and x increases by one every loop

count(x + 1,10)
x below 10




fokane
74 posts
msg #58717
Ignore fokane
1/3/2008 4:59:51 AM

Thanks Niko, I appreciate your time. I'll check out your idea.
I want to spend more time looking at charts too which i will once i get this sorted.

basher
6 posts
msg #71329
Ignore basher
2/11/2009 5:35:54 PM

Yes, SF does allow you to emulate loop logic by using the count and sum keywords.

For example, lets say you want to detect if a stock had 15 down days (red) out of the last 20. The script would be:

Fetcher[
set{ is_red_day, count( open is above close, 1 ) }
set{ num_red_days, sum( is_red_day, 20 ) }
show stocks were num_red_days is above 14.99
]





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