athrasher05 4 posts msg #122509 - Ignore athrasher05 |
1/11/2015 8:03:53 PM
Is it possible to run a filter that takes an average of two indicators? Expanding on the work done by Kevin_in_GA I want to see the average of the sum between a z-score and a Williams %R. I tried creating a set function but I can't seem to get it to work, if it's even possible to do with in SF.
Any help would be appreciated.
|
Kevin_in_GA 4,599 posts msg #122510 - Ignore Kevin_in_GA |
1/11/2015 8:23:21 PM
I think you can do this fairly easily. Here is a generic example
set{2indicators, RSI(2) + Williams %R(2)}
set{sumof2indicators, sum(2indicators,20)}
set{averageof2indicators, sumof2indicators / 20}
Now if you want to determine the Z-score of this 2 indicator sum you would just do the following:
Not all that great a combo for picking bottoms, but that was not the purpose here - hopefully this shows you how to accomplish what you were asking (plus a little bit more that might be irrelevant).
|
athrasher05 4 posts msg #122511 - Ignore athrasher05 |
1/11/2015 8:40:18 PM
Thanks Kevin,
I think that'll work. I'll try it right now. What I'm trying to do is expand upon your system of using z-score mean reversion. You had sorted by z-score ascending but I want to test is sorting by stocks that meet the screening criteria but then sort by an average z-score + William %R. Through testing I've noticed that some stocks that may not have the lowest z-score to be picked up but have very low William %R and relatively low z-scores perform well. Still something I'm digging into. I really appreciate you sharing your initial strategy and thoughts on the z-score.
|
athrasher05 4 posts msg #122596 - Ignore athrasher05 |
1/23/2015 4:03:19 PM
Kevin,
Still having issues with this.
Simply want to take the zscore code you wrote:
SET{PRICERATIO, CLOSE / IND(^spx,CLOSE)}
SET{RATIOMA16, CMA(PRICERATIO,16)}
SET{RATIOSTD16, CSTDDEV(PRICERATIO,16)}
SET{DIFF16, PRICERATIO - RATIOMA16}
SET{ZSCORE16, DIFF16 / RATIOSTD16}
And then combine ZSCORE16 with Williams %R(16).
For example, if the Z Score for a stock is 3.5 and the Williams %R reads at -92. I want to multiply them to get -322. I then want to have SF sort by that figure. But I'm having trouble coding it.
Thanks for help.
|