StockFetcher Forums · General Discussion · Combining VIX readings with stock filter<< >>Post Follow-up
ericdarby
6 posts
msg #95886
Ignore ericdarby
8/30/2010 11:59:58 AM

Good morning, is it possible to combine a reading from the VIX or the SPY to a stock filter? For example:

Buy stocks only when VIX is above its MA(10)
or
Buy stocks only when the SPY is aboves its MA(200)

Thanks in advance for any reply.

Kind regards,

Eric Darby

olathegolf
119 posts
msg #95887
Ignore olathegolf
8/30/2010 12:49:02 PM

Kevin_in_GA has already posted a filter like this:

http://forums.stockfetcher.com/sfforums/?q=view&fid=1002&tid=92678&qrid=&isiframe=

Kevin_in_GA
4,599 posts
msg #95888
Ignore Kevin_in_GA
8/30/2010 1:10:45 PM

StockFetcher makes this easy to do - it's just a matter of learning a few lines of code that are easy and quite helpful.

You can always reference another stock to decide whether or not a filter should return any results (in your case, only give results when the SPY is above its MA(200). Let's walk through this process so you can learn it.

1. Create a custom user-defined variable that refers to the current value of the stock or index that you want to use as a trigger:

set{ind(SPY, close)} - this creates a variable called SPY that refers to the current price of SPY

2. Create a custom moving average of the user-defined variable:

set{SPYMA, cma(SPY, 200)} - this creates a 200 day moving average of the SPY variable

3. Add a line of code that requires the SPY variable to be above the SPYMA

SPY above SPYMA

this last line will need to be true for the filter to return any results - therefore you have made it so that you only get stocks from the filter if the SPY is above its MA(200).

ericdarby
6 posts
msg #95893
Ignore ericdarby
8/30/2010 7:05:04 PM

Hi Kevin,

I added these 3 lines of code to my filter but it gave me a PAGE NOT FOUND error when I tried to test or save.

set{ind(SPY, close)}
set{SPYMA, cma(SPY, 200)}
SPY above SPYMA

- Eric

Kevin_in_GA
4,599 posts
msg #95894
Ignore Kevin_in_GA
8/30/2010 7:19:29 PM

my bad - first line should read

SET{SPY, ind(SPY, close)}

ericdarby
6 posts
msg #95908
Ignore ericdarby
8/31/2010 11:50:37 AM

Thanks Kevin,

Armed this information, I am trying to code a VIX correlation also. Basically I want to create something like this:

VIX is at least 5% above its MA(10)

Here is my first attempt

SET{VIX, IND(VIX, close)}
SET{VIXMA, cma(VIX, 10)}
VIX at least 5 percent above VIXMA

Kevin_in_GA
4,599 posts
msg #95913
Ignore Kevin_in_GA
8/31/2010 4:18:46 PM

Or this:

SET{VIX, IND(VIX, close)}
SET{VIXMA, cma(VIX, 10) * 1.05}
VIX above VIXMA


StockFetcher Forums · General Discussion · Combining VIX readings with stock filter<< >>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 2022 - 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


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.