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.

50/200 DMA Close Proximity Scan

Hi there Guys.

I’m looking to create a scan that would target stocks in a Bollinger squeeze (< 6%) and would have both the 50 and 200 DMA in close proximity to current share price. I’m thinking within 4-6% of the SP. I currently have scans for the Bollinger squeeze however having trouble adding in the SMA’s. Any thoughts?

Thank you

Garth

Comments

  • markdmarkd mod
    edited September 2019
    Pick some per cent that means "in close proximity" to you - e.g. one per cent, then test for close less than sma times 1.01 and close > sma times .99. This works because 1.00 = 100 percent (in other words, the sma), so .99 equals 1 per cent below and 1.01 equals 1 per cent above the sma. So, you will get a hit for any price less than the sma PLUS 1 per cent (sma * 1.01) AND greater than the sma MINUS 1 per cent (sma * .99). You have to do this for both smas. You might have to play around with the one per cent - maybe 5? 10? You don't know until you see the results. Also try back dated scans - maybe December when falling prices would have brought the 50 nearer the 200 for most stocks.
  • Awesome thank you very much!
  • Hi Markd,

    This is what I came up with but it contains syntax errors I cannot correct. Are you able to point me in the right direction?

    Thank you kindly!

    [type = stock]
    and [country = canada]
    and [daily sma(20,daily volume) > 100000]
    and [daily sma(50,daily close) > 20]
    and [[[Upper BB (20,2) - Lower BB (20,2)] / Close ] < .06]
    and[ [Close >SMA(50,close) *0.98] x [ SMA(200,close)]]
    and [[Close <SMA(50,close) *1.02] x [ SMA(200,close)]]
  • In lines 6 and 7 you have two operators - line 6 has ">" and also "x"; line 7 has "<" and "x". So you are asking for two things in one line - close versus per cents of the sma50 AND a crossover of something. You can't have two comparison operators in the same "and [ ,,, ] clause ("x" is a comparison operator, although it doesn't look like it).

    In any case, your original conditions don't specify a crossover. I'm guessing you included it because you want the MAs close together. But all you need to do is make the same close to MA comparisons you have for the 50 to the 200. If all four comparisons are true, then the MAs would have to be close together. The trick is to figure out what per cent parameters will work the way you want them to. Maybe the per cent parameters for both the 50 and the 200 should be the same, or maybe slightly different.
  • Thank you very much Markd!

Sign In or Register to comment.