StockFetcher Forums · General Discussion · BETWEEN Doesn't Seem To Work Right<< >>Post Follow-up
Underworlds
30 posts
msg #100128
Ignore Underworlds
4/5/2011 8:31:18 PM

The use of the operational word BETWEEN does not seem to be working properly. Please take a look at my code and let me know if it is something that I may have done wrong in the coding.

Using the following code...


Fetcher[/* Get average size of candlestick */
set{bodysize, abs(open minus close)}
set{avgbodysize, CMA(bodysize,5)}
set{shortbodysize, avgbodysize / 3}
set{longbodysize, shortbodysize * 5}

set{currentsize, close - open}

add column avgbodysize {AVG}
add column shortbodysize {SHORT}
add column longbodysize {LONG}
add column currentsize {CURRENT}

show stocks where currentsize is between shortbodysize and longbodysize
]



The results returned included stocks where the value of currentsize was outside of the range established by shortbodysize and longbodysize.

For example, results included...

NSM
short = 0.03
long = 0.14
current = -0.04

SIRI
short = 0.01
long = 0.07
current = 0.08

MSFT
short = 0.03
long = 0.14
current = -0.04

These three incorrect returns appeared on the very first page returned. The filter returned a total of 11,319 stocks. This tells me that something is definitly wrong here.

stockfetcher
980 posts
msg #100130
4/5/2011 9:05:37 PM

The "between" phrase only works with constant values. Please see:

http://forums.stockfetcher.com/sfforums/?q=view&fid=1007&tid=24002

Thank you,

StockFetcher Support

Underworlds
30 posts
msg #100131
Ignore Underworlds
4/5/2011 9:36:10 PM

Aha!!! Thanx for the fast response stockfetcher. Guess I'm gonna have to figure a work-around for that situation then.

stockfetcher
980 posts
msg #100132
4/5/2011 10:00:28 PM

Simply break the original statement into an above and below:

show stocks where currentsize is above shortbodysize
and currentsize is below longbodysize

StockFetcher Support




Underworlds
30 posts
msg #100134
Ignore Underworlds
4/5/2011 11:33:16 PM

Once again, thanx for the great support. I found just the trick to get this filter working the way I need it to work...

Fetcher[/* Get average size of candlestick */
set{bodysize, abs(open minus close)}
set{avgbodysize, CMA(bodysize,5)}
set{shortbodysize, avgbodysize / 3}
set{longbodysize, shortbodysize * 5}

set{currentsize, close - open}

add column avgbodysize {AVG}
add column shortbodysize {SHORT}
add column longbodysize {LONG}
add column currentsize {CURRENT}

/* Get candlesticks with medium body size */
set{A, count(currentsize greater than shortbodysize, 1)}
set{B, count(currentsize less than longbodysize, 1)}
set{X, A + B}
show stocks where X equal 2
]



I may have to adjust the upper and lower limits a bit to get a better interpretation of a candlestick with a medium body size, but at least it works.

StockFetcher Forums · General Discussion · BETWEEN Doesn't Seem To Work Right<< >>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.