StockFetcher Forums · Filter Exchange · Putting ^SPX in a script line<< >>Post Follow-up
glgene
534 posts
msg #102878
Ignore glgene
10/9/2011 4:22:32 PM

I have never written a script with ^SPX in it, and on my first attempt, something is wrong.

Fetcher[
symlist(^SPX)
add column CCI(20)
]



I don't get the results on ^SPX, but rather the results on all 10,068 stocks.

Can you not put an indice, e.g., ^SPX, in a script? If you can, how should I change my simple script line above?

Gene

straken
469 posts
msg #102879
Ignore straken
10/9/2011 7:14:38 PM

^SPX is an index, not a stock..and cannot appear in filter results due to lack of data. However you can use the index for comparison or correlation or indicator position. See knowledgebase for info.

Link Here

glgene
534 posts
msg #102880
Ignore glgene
10/9/2011 8:44:34 PM

Straken,
Thanks. But a little confused. Would you show me a quick 2 or 3-line SF script that could, for example, include ^SPX for a beneficial reason?

I was hoping to include ^SPX in a Force Index calculation. I guess that is out.

Gene

straken
469 posts
msg #102890
Ignore straken
10/10/2011 1:17:49 PM

Gene,
Heres one of my old Force Index filters. I added some ^SPX correlation to so you could see how its used. Feel free to edit as you need.

Fetcher[
price > 8
price > open
optionable
fichg > 1000000

set{var5, Average Volume(10)}
set{var6, Volume}
set{sum1, var6 / var5}
set{vratio, sum1 * 1}
add column vratio

set{var7, FI(2)}
set{var8, FI(2) 1 day ago}
set{fichg, var7 - var8}
add column fichg

average volume(30) > 250000
and corr(^SPX,10,Close) is above 0.75
and add column corr(^SPX,10,Close)
and compare with ^SPX
]



glgene
534 posts
msg #102892
Ignore glgene
10/10/2011 1:49:37 PM

Thanks, again, Straken...

Your example is well taken. I'll work thru it.

By the way, did you know that SF computes the Force Index on SMA, not EMA. I brought this to their attention and they sent me the conversion code to comply with EMA.

Dr. Alexander Elder, creator of the Force Index, clearly modeled it with EMA in the equation. With your FI(2) example, it amounts to not using 50% SMA, but 67% EMA.

EMA = 2/N+1
EMA = 2/2+1
EMA = 2/3
EMA = .667

Whereas with SMA, each day of the 2 days is worth .500 each.

But that's beside the point with my question re: ^SPX. Is correlation the best use for it?

Gene

glgene
534 posts
msg #102894
Ignore glgene
10/10/2011 2:35:34 PM

Correction to my previous post, where I said: "With your FI(2) example, it amounts to not using 50% SMA, but 67% EMA." Should have read the reverse. Standard SF scripting (SMA) would have FI(2) resulting in 50% weighting instead of 67% weighting in EMA for FI(2).

Using the generic FI(13) setting, SMA weighting would be 7.69% (1/13) vs. EMA weighting of 14.28% (2/N+1).

Gene



straken
469 posts
msg #102895
Ignore straken
10/10/2011 2:44:32 PM

Gene,
Thats an old filter that I dont use anymore for the reasons you mentioned along with the rounding function would not work to close up FI readings. When I wrote it I was looking for just a few decimals along with a volume ratio, thats why you may wonder why the code starts with var6 or something like that. Its just a piece of a filter I snatched out to add the index corr and compare to just to give you an example. I really haven't delved into many correlation filters because I trade individual stock options based on there own merits or lack of and really have no need for index corr. I assume it may be useful to those who trade stocks that are part of that index to find a correlation coefficient as signs of movement but I mainly watch the option pits for the majority of my trades. There are a few filters I still use here but I have migrated most of them over to stockfinder for the realtime data. Hardest decision I'm facing today is whether to keep holding ATVI or unload it. Its still getting good coverage over the MW3 release coming out. I picked it off at 10.50 expecting good results from the MW3 release but I expect its due for a pullback soon.

StockFetcher Forums · Filter Exchange · Putting ^SPX in a script line<< >>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