Click here to Login

                                                   Screen for non trending stocks?


2011-03-19 17:06:55

Hello guys,

I need a formula/indicator that would allow me to screen the stocks that have been stuck in a narrow price channel for 3-5 periods.

Maybe a screener that shows the stocks where the moving average has been flat for the last 3-5 periods/bars. I have no idea how to do that. If anyone could help...


Peter Gum
2011-03-19 19:40:46


Why doesn't this do it:
where 'a' is between an upper and lower threshhold as a filter.


2011-03-20 08:00:13



I'm not sure I understand how this works... For example, I didn't get the how can 'a' can define both the upper and lower threshold? And also, the "channel" I'm looking for isn't defined by two absolute values but rather by a relative frame.

Yeah, sorry I'm really a newb at this! Thanks for helping.

Peter Gum
2011-03-20 08:43:04


No problem. I'm new at this myself. I'm trying to answer to test my understanding. The guru will step in when I get it wrong [grin].
- Create a dynamic watchlist.
- On the first screen (or after clicking "Update Selected Watchlist") add rows to filter symbols from the quotes database.
- Click "Next" and enter:
a=LinearReg_Slope(5); // A linear regression line through the last 5 closes.
filter= a<0.1 && a>-0.1; // Filter slope to be between two values. "True" passes.
-Click "Compile". Click "Finish".
You should see a filtered list. Double clicking a Watchlist will show it anytime.
If you return to the script window you can add "AddColumn("Slope",a);" to display the value of the slope.

Does this help?

2011-03-20 10:11:06



Yes this worked better. Though for some reason I'm getting half of the stocks to have the desired "flatness" of the Moving average, but some stocks show a declining moving average.

Also, I'm kind of thinking now that the moving average isn't exactly the right criteria to use: I need stocks that have been stable for the last x days, a moving average can be flat with prices that have varied wildly in the last few days, but in such ways that the average has remained the same (so +10$ on one day, -10$ on the second day, the average will be flat).

I guess a price channel would be the better way to go about this. Sorry to cause so much hassle :P

Thanks again!

Peter Gum
2011-03-20 11:58:28


Don't worry about hassle; good questions stoke the learning curve for everyone.
Adjust the filter to remove declining stocks. This currently allows them: a>-0.1. Change that to a>0.0.
If you don't find answers in the documentation (and experimenting) ask again, but:
- 'x' can be made into a variable that is set-able in the GUI, and optimizable over a range in increments. You're gonna like that.
- 'wildly' suggests looking into standard deviation and/or hhv and llv.
- for price channel see Bollinger Bands. There are others as well; look in the indicator window.

Keep digging. There's lots of capability to look at that bears on your questions.


2011-03-21 05:05:27


Best Answer

Here are two other examples:

b = (hhv(high, 5) - llv(low, 5));
a = b / (hhv(high, 50) - llv(low, 50));
filter = a < 0.05;
filter = filter and close > 2 and b > 0;


b = (hhv(high, 5) - llv(low, 5));
a = b / close;
filter = a < 0.02;
filter = filter and close > 2 and b > 0;

The last line is used to reject illiquid stocks and stocks that had no movement during the last 5 bars.

No more messages


No html code. URLs turn into links automatically.

Type in the trading objects you want to include: - Add Objects
To add a trading object in your message, type in the object name, select it and then click on "Add Objects"


Trading Items
Screen for finding potential high volume momentum growth for the ...
The Best trading rules for the ADX technical indicator
Morningstar Annual Fundamentals 2.0 for US and International Stoc...
Trending Up/Down using Ten Moving Averages
Volume Ratio Rank Screen

How-to Lessons
How to screen for stocks having a high correlation with the Dow J...
How to display the number of stocks per day for different RSI gro...
How to quickly download the most recent EOD data for your stocks
How to run a screen or a watchlist from a script
How to get stocks for a particular index using the global script

Related Forum Threads
the code for screen
Screen for MACD crossovers to the upside
Is there an Updated EOD data for Delisted Stocks?
screen problem
Fundamental data for canadian and mexican stocks

Blog Posts
How to download the history of dividend payments for stocks in th...
Put-Call Ratio for Individual Stocks
Fundamental Screen based on Stock price, ROI and Market capitaliz...
10 New Ways to Download Historical Stock Quotes for Free
How to Scan for Parallel Resistance and Support Lines

Create an account
Affiliate Program
Contact Us
Trading Forum
How-to Lessons
About Us
Terms of Use

Copyright 2024
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Follow us on Google+
RSS Trading Items

Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.