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.

Please Help

Hello all! Although I have been a member of StockCharts for over nine years, I just discovered this forum. Having said this, I hope someone here can help me. Recently, I have been following Dave Landry and diving into some of his strategies. In particular, I am interested in his "bow tie" set-up. However, I am having all kinds of difficulties developing a scan that will recognize the convergence of these three MAs. Has anyone developed such a scan? If so, would you please be willing to share it? Thanks in advance for any assistance!


  • I don't follow Dave Landry, but it appears that you just want to compare the order of MAs today vs. the order of MAs x days ago.

    So, sma 10 > sma 20 and sma 20 > sma 30 and sma 30 > x days ago sma 30 (so sma 30 is rising). That gets today's order.

    Then you want the inverse order x days ago: x days ago sma 10 < x days ago sma 20 and x days ago sma 20 < x days ago sma 30. I'm not sure what value to use for x days ago - 4? 5? 6? and I don't think you want to test for sma 30 falling.

    I don't think you have to test for the actual crossovers. If the above conditions are true, then the crossovers must have happened.
  • Thanks for the quick response! I think that's the problem as I am looking to identify when the three MAs crossover as this convergence serves as the trigger for the trade. More specifically, I'm using a 10 day SMA, a 20 day EMA, and a 30 day EMA. I'm trying to identify when the moving averages converge and spread out again, shifting from the "proper" downtrend order (10-SMA < 20-EMA < 30-EMA) to the "proper" uptrend order (10-SMA > 20-EMA > 30-EMA). Thanks again for any help you're able to provide!
  • I should also point out that because we are talking about three separate MAs, the crossovers do not typically all happen in a single day. Usually, this occurs over a period of three to four days. I believe this is what is causing me the problems.
  • I think it would be very complex to consider all possible combinations of crossovers that could lead to the bow tie effect. That's why I recommended testing for "before and after" configurations. If you run the scan every day, you will pick up the first day that all conditions are true. You will likely get some repeats because the condition is likely to be true for any one stock for two or three or several days. It's unlikely you can write one scan that will pick up EVERY bow tie event in your selected universe, but, you could always write two or three versions with longer or shorter look back periods and that should be pretty complete.
  • That's what I was afraid of; you have confirmed my suspicion. (Not being much of a coder, I was hoping I was missing something.) I greatly appreciate you vetting and opining on this topic. Your thought partnership is valued.
  • lmkwinlmkwin ✭✭
    Just a thought. If I understand it correctly, you can't have a bowtie without the 10 crossing the 30. So how about checking for that criteria and then confirming that the 10 has crossed the 20.

    and [MACD Hist(10,30,0) x 0.0]
    and [MACD Hist(10,20,0) > 0.0]

    for a crossing up.

    If looking for a cross below, you'd flip the 1st line and change the > to a < on the second.

  • Interesting.... let me play with it a bit. Thanks again!!
  • lmkwinlmkwin ✭✭
    Ooops. Apparently the bowtie uses 10 SMA, 20 EMA and 30 EMA.

    MACD uses EMA
  • True; but based on your suggestion, I was able to make it work. Your underlying principle works. For the most part, by definition, if the 10 crosses the 30, the 20 is also crossed. Therefore, by identifying that single cross and displaying all three MAs, it seems to be working. Thank you both for your assistance. It is greatly appreciated!
  • PJP, do you mind sharing that syntax? I have been trying to do the same thing you are working on with the bowtie? Plus my last programming class was in Fortran in 1972 and we used hole punch cards.
  • lmkwinlmkwin ✭✭
    If I had to guess,

    and [MACD Hist(10,30,0) x 0.0]
    and [MACD Hist(10,20,0) > 0.0]

    is the Syntax for the scan engine.

    Fill in your universe at the top, followed by the 2 lines above.
Sign In or Register to comment.