StockFetcher Forums · General Discussion · Security-to-Index Trend Comparison<< >>Post Follow-up
CarpeMomentum
8 posts
msg #95298
Ignore CarpeMomentum
7/30/2010 5:53:56 PM

I'm trying to tell my filter to enter a short position only when the ^SPX is in a downtrend, e.g. ^SPX is below its own MA(20). Is this possible? Anyone mind helping me out with the syntax? Any other suggestions on trend comparison between individual securities and indices are welcome too!

Kevin_in_GA
4,599 posts
msg #95299
Ignore Kevin_in_GA
7/30/2010 8:54:51 PM

The syntax is easy ...

1. first set the close of the ^SPX as a user defined variable

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

2. Create a custom MA from the new variable using the CMA function

set{SPXMA, cma(spx, 20)}

3. Now require that SPX be below SPXMA for going short

SPX below SPMA

Viola!

CarpeMomentum
8 posts
msg #95319
Ignore CarpeMomentum
8/2/2010 11:03:50 AM

Thanks! Exactly what I needed!

four
5,087 posts
msg #95324
Ignore four
8/2/2010 4:53:07 PM

Fetcher[
SYMLIST(SPY)

set{SPYa, ind(SPY, LOW)}
SET{COUNT, COUNT(SPYa > SPYa 100 DAYS AGO,1)}
DRAW COUNT
DRAW MA(50)
]



CarpeMomentum
8 posts
msg #95427
Ignore CarpeMomentum
8/6/2010 12:17:42 AM

Thanks!

Is there a way to access Williams %R(3) on an index in the same kind of variable set?

four
5,087 posts
msg #95430
Ignore four
modified
8/6/2010 12:54:52 AM

Fetcher[


set{SPYa, ind(SPY, LOW)}
SET{COUNT, COUNT(SPYa > SPYa 100 DAYS AGO,1)}
DRAW COUNT
DRAW MA(50)



show stocks where Williams %R(3) is above ind(SPY,Williams %R(3))



]



StockFetcher Forums · General Discussion · Security-to-Index Trend Comparison<< >>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.