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.
|
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...
|
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.
|
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
|