StockFetcher Forums · Filter Exchange · Taking an average of two indicators, is it possible?<< >>Post Follow-up
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,537 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:

Fetcher[

set{2indicators, RSI(2) + Williams %R(2)}
set{sumof2indicators, sum(2indicators,20)}
set{averageof2indicators, sumof2indicators / 20}
set{SDof2indicators, cstddev(2indicators,20)}
set{difference, 2indicators - averageof2indicators}
set{zscoreof2indicators, difference / sdof2indicators}

market is S&P 500
add column 2indicators
add column zscoreof2indicators
sort on column 5 ascending
]



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.


StockFetcher Forums · Filter Exchange · Taking an average of two indicators, is it possible?<< >>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 2016 - 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