StockFetcher Forums · General Discussion · Days filter mixed results<< >>Post Follow-up
byebyemoney
31 posts
msg #144339
Ignore byebyemoney
8/8/2018 8:01:07 AM

I have a really simple filter here and was wondering why this filter is giving me the wrong results. From my counting the column high30day should be 27 but it is giving me -1. Any help would be appreciated


filter{
chart-length is 6 months
symlist(jone)
set{high30day, days(high reached a new 30 day high, 30)}
add column high30day
}

graftonian
1,089 posts
msg #144342
Ignore graftonian
8/8/2018 9:29:26 AM

I have a devil of a time with the "days" function. Your filter is returning -1 because the look back time has been exceeded. I modified your filter, but it is still not right.

Fetcher[
chart-length is 6 months
symlist(jone)
set{high30day, days(high reached a new 30 day high, 60)}
add column high30day
set{30HI, high 30 day high}
draw 30HI on plot price
]




byebyemoney
31 posts
msg #144344
Ignore byebyemoney
8/8/2018 9:52:12 AM

graftonian

lol it is one of the most frustrating things...the bazaar thing is...is that when you draw it...it's clearly there...something weird with the logic here

byebyemoney
31 posts
msg #144345
Ignore byebyemoney
8/8/2018 1:31:00 PM

graftonian

is it possible to somehow find the days since the 30 day high?

four
5,087 posts
msg #144347
Ignore four
modified
8/8/2018 3:16:37 PM

perhaps...


Fetcher[
chart-length is 6 months
symlist(jone)
set{high30day, days(high reached a new 30 day high, 60)}
add column high30day
set{30HI, high 30 day high}
draw 30HI on plot price
]



byebyemoney
31 posts
msg #144349
Ignore byebyemoney
8/8/2018 4:23:54 PM

Thanks four,

Yeah I think since the days function calls the 30 day high at whatever point and time it's counting, the first spike is never touched since it is 30 days less than the next high. so unfortunately this can not find the days since the 30 day high starting from today.

It's amazing how hard it is to actually create a filter that can simply find the days since the 30 day high for this type of situation. Basically that 30 day high has to be the 30 day high with no other high before or after it. But if there is a high before 30 days after that one, then it won't ever be able to detect it.

i've even tried to do something like below where i first find the value of the 30 day high, then count when the high reaches that high. Unfortunately this also gives wrong results because the variable is just replaced with the indicator so it functionally does the same thing. I'm wondering if there is a way to save the value of the variable at a certain point and time so when it is used in the days function, it uses a static value.

Fetcher[
chart-length is 3 months

symlist(jone)

set{30dayhi, high 30 day high}
set{ipeak1, days(high equals 30dayhi, 30)}

add column 30dayhi
add column ipeak1

]



byebyemoney
31 posts
msg #144354
Ignore byebyemoney
modified
8/9/2018 7:01:48 AM

Thanks so much four and graftonian. you guys are really helpful. So, other than being able to save variables as constants (best solution), the only way to get this to be correct is by chunking the periods you want to check. modified below to get the correct result

Fetcher[
chart-length is 6 months
symlist(jone)
set{high20day, days(high reached a new 20 day high, 20) 20 days ago}
set{highoffset, high20day + 20}
add column highoffset
set{20HI, high 20 day high}
draw 20HI on plot price
]



StockFetcher Forums · General Discussion · Days filter mixed results<< >>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.