Kevin_in_GA 4,599 posts msg #102238 - Ignore Kevin_in_GA |
8/13/2011 1:24:40 PM
I'm trying to write a simple rank function for 4 ETFs, as shown below. To do this I am using the "count" function for any time an ETF indicator is above the same indicator for each of the other stocks, as shown below;
What should happen is that for this week BND should be given a rank of 1, SPY a rank of 2, EFA a rank of 3, and IWM a rank of 4. Clearly this is not the case, but for the life of me I can't explain why (nor can I explain why BND is not properly compared to itself, where it should get a 0 as the result).
Any thoughts on this from either the SF team or the forum members would be greatly appreciated.
Kevin
|
wantonellis 161 posts msg #102239 - Ignore wantonellis modified |
8/13/2011 2:22:11 PM
|
mahkoh 1,065 posts msg #102240 - Ignore mahkoh modified |
8/13/2011 2:48:53 PM
I've had troubles with weekly syntax when coding weekly pivot points. It turned out that I had to use not weekly high, low and close but weekly high one week ago etc to get the correct numbers.
I tried this on your filter and I think this makes it accurate.
|
Kevin_in_GA 4,599 posts msg #102295 - Ignore Kevin_in_GA |
8/16/2011 1:10:41 PM
This seems to work, although it requires more thought and coding to recreate the ROC function on a weekly basis. Not sure why the addition of "weekly" to this function is causing problems, but since no one from SF has bothered to respond I guess we'll never know.
|
heypa 283 posts msg #102296 - Ignore heypa |
8/16/2011 1:24:54 PM
Perhaps it is because the weekly scan is correct on only one day a week,namely Monday.
|
mahkoh 1,065 posts msg #102298 - Ignore mahkoh |
8/16/2011 1:49:41 PM
No need to use "weekly close", for the current week this is the same as "close"
I was wondering,do you think this has implications for your 401K filter?
|
stockfetcher 980 posts msg #102299 |
8/16/2011 3:06:37 PM
Hi -
The issue is related to how custom variables and counts handle weekly data. Once you create a custom variable, the variable is established as a "daily" variable.
While not an ideal solution, the example below may do what you are looking for.
|
Kevin_in_GA 4,599 posts msg #102307 - Ignore Kevin_in_GA |
8/16/2011 5:18:33 PM
I actually like this approach. It allows you to modify var1 only once versus in every line of code that refers to it.
|