some very simply code below (in theory) and I can’t explain some of the results eg the screen returns MNG (UK) where the close was last below 20ma 4 bars ago but 32 is returned – this is driving me nuts what on earth am I doing wrong?
assigns C1 the bar where the condition has been met, which will ALWAYS retain a value other than 0, so it will always be true, thus returning ALL instruments.
Try changing the last line so that it only scans the instruments where the condition has only been met within the last 5 (or any other number of your choice) bars:
So I was not adjusting for dividend, data now look consistent. Thanks so much.
This leads onto a separate question, should adjustment be enabled or disabled. The chart for the particular asset I was looking is massively different probably becuase it has a hefty 10% yield!
When you use a “screener” you always have to adjust the data for dividend because a “screener” works with “real-time” data (data adjusted for dividend)…
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.