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.
Pullback Scan
Hello, I am writing a script for pullbacks. Seems I am having issues when trying to add the inside day to my scan. I am trying to accomplish 3 days of lower daily lows, or two days of daily lower lows and an inside day. Thanks in advance
[type is stock]
and [country = US]
and [ [exchange is NYSE]
or [exchange is NASDAQ] ]
and [Volume > 500,000]
and [Close > 10]
and [Close > sma(20)]
and [Close > sma(50)]
and [ [Low IS BELOW 1 day ago low]
and [1 day ago Low IS BELOW 2 days ago low]
or [Low IS BELOW 1 day ago low]
and [1 day ago Low IS BELOW 2 days ago low]
and [High IS BELOW 1 day ago High]
and [Low IS ABOVE 1 day ago Low] ]
[type is stock]
and [country = US]
and [ [exchange is NYSE]
or [exchange is NASDAQ] ]
and [Volume > 500,000]
and [Close > 10]
and [Close > sma(20)]
and [Close > sma(50)]
and [ [Low IS BELOW 1 day ago low]
and [1 day ago Low IS BELOW 2 days ago low]
or [Low IS BELOW 1 day ago low]
and [1 day ago Low IS BELOW 2 days ago low]
and [High IS BELOW 1 day ago High]
and [Low IS ABOVE 1 day ago Low] ]
0
Comments
-
"OR" conditions are tricky.
See if this re-grouping does it. I've added a pair of brackets around the two lines of the first "or" condition and another pair around the four lines of the second "or" condition.
P.S. I only checked the brackets, not the logic of each line.
[type is stock]
and [country = US]
and [ [exchange is NYSE]
or [exchange is NASDAQ] ]
and [Volume > 500,000]
and [Close > 10]
and [Close > sma(20)]
and [Close > sma(50)]
and
[ // begin "or"
[ // first "or" group
[Low IS BELOW 1 day ago low]
and [1 day ago Low IS BELOW 2 days ago low]
] // end first or group
or
[ // begin second "or" group
[Low IS BELOW 1 day ago low]
and [1 day ago Low IS BELOW 2 days ago low]
and [High IS BELOW 1 day ago High]
and [Low IS ABOVE 1 day ago Low]
] // end second or group
] // end "or"0 -
Thanks for you response, are you suggesting my script look like this?
[type is stock]
and [country = US]
and [ [exchange is NYSE]
or [exchange is NASDAQ] ]
and [Volume > 500,000]
and [Close > 10]
and [Close > sma(20)]
and [Close > sma(50)]
and
[[Low IS BELOW 1 day ago low]
and [1 day ago Low IS BELOW 2 days ago low]]
or
[[Low IS BELOW 1 day ago low]
and [1 day ago Low IS BELOW 2 days ago low]
and [High IS BELOW 1 day ago High]
and [Low IS ABOVE 1 day ago Low]]
I am very new to writing scripts. Thx0 -
I do it my way because I think its easier to read.
If your version has the same placement of brackets, then it's the same.
The slashes // are comment symbols, meaning the scan engine does not read anything after // on the same line.
Also, the scan engine allows blank lines - it figures out where the opening and closing brackets are and which goes with which even across multiple lines. So you can space out the scan lines as I did for readability. But everyone is different and your way is fine if it works for you.0 -
Thanks, I just copied yours as is and I get the same results. I am working at it; I like your look better, still having trouble getting the right results once I implement the last four lines. All looks good until I add those parameters. Frustrating0
-
I'd may suggest replacing IS BELOW with a < symbol. Although some things may "pass" syntax checks, the current scan engine may disregard or misinterpret some of the original "common english" allowable terminology.0
Categories
- All Categories
- 2.3K StockCharts
- 395 SharpCharts
- 146 Other Charting Tools
- 69 Saved Charts and ChartLists
- 1.5K Scanning
- 73 Data Issues
- 177 Other StockCharts Questions
- 218 Technical Analysis
- 155 Using Technical Analysis
- 2 InterMarket and International
- 19 Market and Breadth Indicators
- 42 Market Analysis
- 109 Trading
- 109 Trading Strategies
- 163 S.C.A.N the StockCharts Answer Network forum
- 65 Using this StockCharts Answer Network forum
- 98 s.c.a.n. archives
- 5 Off-Topic
- 6 The Cogitation & Rumination Emporium
- Forum Test Area