StockFetcher Forums · Filter Exchange · Setup simple triggers<< >>Post Follow-up
DVMayfied
8 posts
msg #136131
Ignore DVMayfied
5/30/2017 6:30:42 PM

Hi all! I'm trying to figure out the best way to setup simple triggers or alerts for very simple criteria. My first approach is to just create a filter, but I'm not sure if that is the right approach. I want to setup an alert that will tell me when SPY is over its MA(200) AND Vix is 5% above its MA(10)

I did this but it isn't working as anticipated...

apply to symlist (SPY, VIX)
SPY Close above MA(200)
and VIX Close More than 5 percent Above MA(10)

Kevin_in_GA
4,599 posts
msg #136132
Ignore Kevin_in_GA
5/30/2017 7:12:30 PM

The ^VIX is an index, so it cannot be called in a filter as you are trying here:

apply to symlist (SPY, VIX)
SPY Close above MA(200)
and VIX Close More than 5 percent Above MA(10)

This should work

Fetcher[
symlist(SPY)
Close above ma(200)

/*Now a quick check to see if the ^VIX is more than 5% above its MA(10)*/
set{vix, ind(^vix, close)}
set{vixma, cma(vix, 10)}
set{vixratio, vix / vixma}
set{trigger, count(vixratio above 1.05, 1)}
add column trigger
]


At the moment would not return SPY since the ^VIX is not more than 5% above its MA(10). you can see this by looking at the column called "trigger" - if there is a "1" in it then that criterion is being met, otherwise it returns a "0".

Hope this helps.



DVMayfied
8 posts
msg #136133
Ignore DVMayfied
5/30/2017 8:01:53 PM

This helps a lot! Thank you very much

Kevin_in_GA
4,599 posts
msg #136134
Ignore Kevin_in_GA
5/30/2017 9:39:16 PM

Glad to help. Note that some of the code I used here may not be familiar to you just yet. I suggest reading the user manual, and looking at code written by folks here in the forums. There are a lot of good sources here that can help you get better at SF syntax and coding.

StockFetcher Forums · Filter Exchange · Setup simple triggers<< >>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.