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