New Members: Be sure to confirm your email address by clicking on the link that was sent to your email inbox. You will not be able to post messages until you click that link.
Finding lowest CCI in monthly charts(historically)
What is the best way to scan stocks on a monthly chart for the stocks that have the lowest CCI (currently)
a) either in its history
b) during the past 20 years All on monthly charts
Assuming it does, you would write
and [monthly CCI(20) = monthly min(240, monthly CCI(20))]
That says, this month's CCI is the lowest in 240 months, or 20 years. I haven't run it, so I don't know if you would get any, or any accurate, results.
Try it first for maybe 5 years (60 months), then work up to 20 years and see what happens.
Rank by [monthly min(240, monthly CCI(20))]
as the last line of the scan to see what the values the scan is producing in the last column of the results.
Or change the 240 to 60 like markd suggested and work your way up
You can put this Rank by on any scan to see what lowest CCI(20) value is for the results. Or change the CCI to something else. Rank By is a great way to add additional color to your scan results.
FYI, if you aren't seeing the results of the Rank By in the last column, the Rank By is either not formatted correctly or is invalid, or there is some math that it's not happy with.
From the Scan Engine documentation:
"Our Scan Engine contains 3000 daily data points (roughly 12 years) for each of the 50,000+ different stocks, indices and mutual funds that we track. This price data can be used to calculate values for several different technical indicators. (Note that scans using indicators that require more than 12 years of data will lose accuracy.)"
This gives results (I didn't check for validity).
// begin scan
[group is sp500]
Rank by month min(10, month CCI(20))
For some reason, the rank by statement takes "month" without an error, but not "monthly". However, with the "10" parameter and "monthly" it produces the same results as "10" and "month".
With "240" and "month", it produces results, but the rank by column on the results page is blank and the results are in alpha order by symbol. Whenever you get rank by results in alpha order by symbol, it means there is an error with the rank by statement (although this isn't documented anywhere, as far as I know). So I'm guessing "240" is too large.