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.

Can anyone write this scan syntax?

I need a scan syntax and being a novice I have no idea what I am doing.

Here is the scan I'm trying to write:

A stock makes a 52-day high and after that for 3, 4, 5, 6 or 7 consecutive days the stock makes lower highs.

That's it! It seems simple enough but being a notice I have no idea how to write it.

Can anyone write that?

Thanks in advance.

Best Answer

  • markdmarkd mod
    edited November 4 Accepted Answer
    Well, it's more complicated than you might think.

    You have five different cases:

    52 week high 4 days ago then 3 consecutive lower highs
    52 week high 5 days ago then 4
    52 week high 6 days ago then 5
    etc.

    Each of those has to be coded separately.

    The first one would be:

    and [4 days ago high = 4 days ago max(251,high)]
    and [Streak Down(high) = 3]

    For the next one, you have to adjust the numbers for 5 days ago, etc.

    and [5 days ago high = 5 days ago max(251,high)]
    and [Streak Down(high) = 4]


    If you want all the cases in one scan, you have to link them together in an "or" statement:

    // begin scan

    [exchange is NYSE] // or whatever

    and

    [ // begin or statement

    [ [4 days ago high = 4 days ago max(251,high)]
    and [Streak Downn(high) = 3]]

    or

    [
    and [5 days ago high = 5 days ago max(251,high)]
    and [Streak Downn(high) = 4]
    ]

    or

    etc.

    ] // end or statement

    // end scan

    When you write it yourself, just do one case at a time starting with the first, then add the second, etc.

    Stockcharts has made it easier and easier to write scans, but they don't write themselves. You will have to put some time in if you want to master it. You could start here:

    https://support.stockcharts.com/doku.php?id=scans:advanced_scan_workbench



Answers

  • Thank you for your help. I managed to get all the individual scans into one scan.

    I spent a lot of time trying to solve this in StockCharts scan tutorial. I also did a lot of Google searches. I wish I knew about this forum sooner.

    The problem is I'm a right-sided brain person = creativity and the arts.
    I find this scan syntax difficult.

    Thanks again,
    Barry
  • Actually, musicians often make the best programmers. Don't know why, but it's true.
Sign In or Register to comment.