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
|
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
|