StockFetcher Forums · Filter Exchange · Only show stocks when ^SPX above MA<< >>Post Follow-up
duke56468
683 posts
msg #95577
Ignore duke56468
8/11/2010 3:06:07 PM

Is there a way to tell the filter to show stocks only when S&P 500 is above its MA(X) and MA(X) is above MA(Y)? Here is what I tried among other things.

and set{sp12,^spx MA12}
and set{sp26,^spx MA26}
and sp12>sp26
and ^spx>sp12

Kevin_in_GA
4,553 posts
msg #95579
Ignore Kevin_in_GA
8/11/2010 3:44:08 PM

Is there a way to tell the filter to show stocks only when S&P 500 is above its MA(X) and MA(X) is above MA(Y)? Here is what I tried among other things.

and set{sp12,^spx MA12}
and set{sp26,^spx MA26}
and sp12>sp26
and ^spx>sp12
++++++++++++++++++++++++

1. Create a user-defined variable of the ^SPX:

set{SPX, ind(^SPX, close)}

2. Use the custom moving average (CMA) function to create 2 moving averages of the SPX:

set{SPXMA12, cma(SPX, 12)}
set{SPXMA26, cma(SPX, 26)}

3. Now simply use the following lines of code to get the relationships you are looking for:

SPX above SPXMA12
SPXMA12 above SPXMA26

So all you need to do is to add the following line to your filter:

set{SPX, ind(^SPX, close)}
set{SPXMA12, cma(SPX, 12)}
set{SPXMA26, cma(SPX, 26)}

SPX above SPXMA12
SPXMA12 above SPXMA26


Now the filter will only return results if the above criteria are met.

duke56468
683 posts
msg #95583
Ignore duke56468
8/11/2010 4:29:48 PM

Thanks Kevin,
As always..very helpful, and educational at the same time.

Kevin_in_GA
4,553 posts
msg #95584
Ignore Kevin_in_GA
8/11/2010 4:33:05 PM

That is my goal. Glad it will help you.

StockFetcher Forums · Filter Exchange · Only show stocks when ^SPX above MA<< >>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