I'm pretty new to the thinkscript and have been trying without avail to program a script to do what I want. I am hoping some of the experts here can help to start me off
I'm trying to do a study filter in the stock hacker which will screen for the stocks that will meet the following criteria:
1. Closing price of previous trading day crossed below 22 SMA (SMA based on closing prices of past 22 trading days)
2. Current price still below 22 SMA
close from 1 bars ago is less than Average("data" = close, "length" = 22) and close is less than Average("data" = close, "length" = 22)
What I'm trying to do is to scan for stock whose price is under the 22 SMA the previous trading day and current price is still under the 22 SMA. I hit "scan" and the scan results doesn't seem to be what I want. Some of the stocks have their current price above the 22 SMA. What am I missing here?
Hockster, the formula, you created is right one. Sometimes the scanner of ToS returns bad results...no one still know why. Check the timeframe setting on which your scan query is working on.
also you can try this query: (the same as yours)
plot scan = close < average (close,22) && close < average (close,22);
Dont forget to set "D" as timeframe....
The following user says Thank You to growex for this post: