Problems with ALL scans

ChuckNZ

New member
VIP
After 12 hours of research using google, I can't find anyone else reporting this issue. That either means that I'm doing something wrong or this is a new problem and other users haven't seen it yet. I have this problem on 4 different PC's and another user I asked to confirm is experiencing the same problem. It was happening with scans using my own studies and I didn't want to get into explaining what they do. No secrets, just overly complex for discussion purposes. I have tested 12 TOS-supplied studies (like MovingAverageCrossover) and they also show wrong results.

So, here is what is happening (using hourly data for the chart and the scan):

1. Pick a study with clear, obvious signals. Like MovingAverageCrossover.
2. Put it on a chart.
3. Create a scan using that study and it's buy signal. Note that sell signals have the same problem.
4. Run the scan and look at the charts for some of the tickers selected by the scan.
5. I am seeing dozens of tickers selected by the scan that don't show a current (or even recent) buy signal using the same study.
6. On the scan for Friday 21 October 2022, for instance, it shows OZ as a "buy" in the scan.
7. The last buy signal, using hourly data, for OZ was about 12 trading hours earlier (according to the chart's study).
8. The timeframe is NOT the issue. I have the same problem with daily, 5-minute, 15-minute, etc. data.

I hope someone here can confirm that they see the same problem and/or can tell me how to make it go away.

EDITED--
An example:
Let me start by saying that I would never trade a MovingAvgCrossover strategy and I wouldn’t trade OZ. I used this study purely because everybody has it and most understand it. I have a similar issue with every study that I tried, so I may as well demonstrate my problem with an easy-to-understand study. OZ is just one of hundreds of tickers that are, in my opinion, not working properly. Here is the results of my scan:


The scan uses the TOS-supplied MovingAvgCrossover, default settings of 15 and 30. The output of the scan shows that the averages for OZ on the 21st of October 2022 were identical: 88.36 (15-day) and 88.36 (30-day). That is purely coincidence and, I’m sure, not related to the problem. The moving averages for the other tickers look reasonable and are not duplicated.

I then created an hourly chart for OZ and pasted the two simple moving averages on the chart using two copies of the SimpleMovingAvg study as supplied by TOS. The yellow line is the 30-day moving average which the MovingAvgCrossover study calculated on 21 October as 88.45. The light blue line is the 15-day moving average which the study calculated as 88.32. I have calculated these two moving averages by hand and my numbers agree with the study. Why not?? But neither agree with the output of the scan.


The blue circle on the study below shows the last buy signal which occurred using the TOS-supplied MovingAvgCrossover study. As you can see, the buy signal appears several days ago, certainly not on the 21st of October. So OZ should NOT BE showing in the scan output.


As I mentioned, every TOS user has the MovingAvgCrossover study, so I'm not able to share it. If necessary, I could copy the code to a new study and share that one, but that just seems silly.

I will share my scan, but it's just a basic scan that uses the MovingAvgCrossover study.

https://tos.mx/CtQIBPM

I'm having to visually inspect about 500 charts every day (until I can figure out my problem and fix it) and it's becoming tedious.

Any help would be appreciated. By the way, I think I lied (not intentionally) when I said that it failed on daily data. I now think that it is working ok on daily data. Just failing on anything less than daily.

If I'm correct, everyone should be concerned about this problem (assuming that it is really a problem), because it affects EVERY study-driven scan on timeframes less than daily.

Thanks for patiently going through my verbose description. I hope the images come through. I won't know until I post it.

I'm running these hourly scans several hours AFTER the markets have closed, so candles are NOT changing on me. I have tried offsets in the scan of 0, 1 and 2. I have tried displacements in the study of -1, 0 and 1. By fiddling with offsets and displacements, I can make tickers come and go from the scan and signals come and go on the chart study. But, so far, I have not managed to get them to agree.
 
Last edited by a moderator:
Solution
On the ToS platform, it is possible for a trigger to occur DURING the candle formation and thus show up on your scan results but
does not exist upon completion of the candle formation, so doesn't show up on your charts.

The workaround would be to:
  • scan for the open of the candle (which won't then be changing during the formation of the candle) or
  • scan for the previous candle close which is represented in thinkscript as close[1] By definition the previous bar is fully formed.
IF scanning for the previous bar, the scan filter MUST be set to with an offset of one.

It can be frustrating. There isn't any in-depth instruction manuals. Scripters end up having to learn to utilize what debugging tools are available and then...
On the ToS platform, it is possible for a trigger to occur DURING the candle formation and thus show up on your scan results but
does not exist upon completion of the candle formation, so doesn't show up on your charts.

The workaround would be to:
  • scan for the open of the candle (which won't then be changing during the formation of the candle) or
  • scan for the previous candle close which is represented in thinkscript as close[1] By definition the previous bar is fully formed.
IF scanning for the previous bar, the scan filter MUST be set to with an offset of one.

It can be frustrating. There isn't any in-depth instruction manuals. Scripters end up having to learn to utilize what debugging tools are available and then plug in various filters to interpolate and get to a result that is sometimes not optimum because the scan hacker is limited in what it can provide.

Example of a debugging tool:
https://usethinkscript.com/threads/how-to-debug-thinkscript.1471/#post-58092
If you do a search on @halcyonguy AddChartBubble debug You will find more examples:
https://usethinkscript.com/threads/search-the-forum.12626/

In the end, scripting is a bunch of user inputs that result in an output. By definition, it can't be 'wrong'. It spits out what is put in.
But as shown in my explanation above, what users believe that they are creating with their filters, is not what is actually happening. The use the debugging tools will tell you what is actually happening, but not necessarily provide you with a workaround.
 
Last edited:
Solution
I honestly thought that I had provided enough information, but I will try again.

Let me start by saying that I would never trade a MovingAvgCrossover strategy and I wouldn’t trade OZ. I used this study purely because everybody has it and most understand it. I have a similar issue with every study that I tried, so I may as well demonstrate my problem with an easy-to-understand study. OZ is just one of hundreds of tickers that are, in my opinion, not working properly. Here is the results of my scan:


The scan uses the TOS-supplied MovingAvgCrossover, default settings of 15 and 30. The output of the scan shows that the averages for OZ on the 21st of October 2022 were identical: 88.36 (15-day) and 88.36 (30-day). That is purely coincidence and, I’m sure, not related to the problem. The moving averages for the other tickers look reasonable and are not duplicated.

I then created an hourly chart for OZ and pasted the two simple moving averages on the chart using two copies of the SimpleMovingAvg study as supplied by TOS. The yellow line is the 30-day moving average which the MovingAvgCrossover study calculated on 21 October as 88.45. The light blue line is the 15-day moving average which the study calculated as 88.32. I have calculated these two moving averages by hand and my numbers agree with the study. Why not?? But neither agree with the output of the scan.


The blue circle on the study below shows the last buy signal which occurred using the TOS-supplied MovingAvgCrossover study. As you can see, the buy signal appears several days ago, certainly not on the 21st of October. So OZ should NOT BE showing in the scan output.


As I mentioned, every TOS user has the MovingAvgCrossover study, so I'm not able to share it. If necessary, I could copy the code to a new study and share that one, but that just seems silly.

I will share my scan, but it's just a basic scan that uses the MovingAvgCrossover study.

https://tos.mx/CtQIBPM

I'm having to visually inspect about 500 charts every day (until I can figure out my problem and fix it) and it's becoming tedious.

Any help would be appreciated. By the way, I think I lied (not intentionally) when I said that it failed on daily data. I now think that it is working ok on daily data. Just failing on anything less than daily.

If I'm correct, everyone should be concerned about this problem (assuming that it is really a problem), because it affects EVERY study-driven scan on timeframes less than daily.

Thanks for patiently going through my verbose description. I hope the images come through. I won't know until I post it.

I don't use scans, but I looked at your issue.

One thing is that with movingaverage lines, especially 1hr ones, move after a cross and disappear when you view them later. When viewing the scan results, it appeared that most differences might be explained by candles that pulled back off their highs during their 1 hr formation and the moving average may have crossed and pulled back (uncrossed) as a result.

Another is that the movingaveragecrossover scan code you used had an "offset' of 1. When you plotted the 2 simple moving averages and the movingaveragecrossover script on your chart, it does not appear that there was a similar 'offset' used. When the scan 'offset' was set to 0, the example OZ, which was visible in the scan with the offset of 1 was not when the offset was set to 0. See the image below of your scan settings.

Hopefully this may help with some of your concern.

Screenshot-2022-10-23-065518.png
 
Last edited:
When scanning with extended hours disabled, the scanner interprets charts as if the Start Aggregations at Market Open setting is disabled. There might be a discrepancy between this and your chart settings. This is especially apparent on 60 minute charts due to the 9:30 opening. A signal does show up for OZ with once these settings are aligned. I ran your scan on 5 minute data and found no major issues.

Same chart of OZ:

1qiHMjx.png


MDd00Of.png
 
Joshua!!!! Bing, Bang, Boom! You get the prize. I run my hourly scans AFTER the market closes, so I want to scan with an offset of zero. But, in order for the chart studies to agree with the scan results, I need to disable "start aggregation at market open" as you suggested. Everything is working perfectly now. By "everything" I mean six TOS-supplied studies (including the MovingAvgCrossover) plus my personal studies that I didn't want to bring into mix. They are based on the BuyTheDip study which all users aren't able to access and they are overly complicated. I chose the MovingAvgCrossover for discussion purposes because of its simplicity and the fact that every user has access and probably understands the logic.

Thanks so much for solving the puzzle for me. It was really getting to me!!!
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
464 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top