Documenting Advanced Scans with our new Comment Feature
One of the latest features added to the Advanced Scan Engine is the ability to add comments to your scans. You can use either the '#' character or the '//' characters to add comments in your scan expression. When the scan engine sees one of these markers it will ignore the rest of the text on the current line all the way to the end of that line. Necessarily, the scan engine now allows you to break scan parameters across new lines and preserves white space so that scans don't have to be single long lines any more.
Comments are a great way to help you remember what that tricky scan is actually doing as well as making the scan more readable.
Some scans might be pretty obvious such as this one:
But others can get quite complex…just what does that last part do? (Bullish MACD Crossover & Breakaway Gap Up)
Wouldn't it be much easier to read if it looked more like this:
You can also quickly adjust your scans by adding or removing parameters by making them comments:
The next scan is the same as the previous one, but in this case we decide to remove the Bullish Engulfing parameter by adding a comment marker at the beginning of the line:
That is much easier and faster than removing the line completely and having to add it back again.
Be aware that if your scan expression goes across multiple lines you may need multiple comment markers to remove it from a scan:
If we break the Bullish 50/200 MA Cross string into two lines vs one big, long one, we need to add more comments to make sure we don't get unintended parameters in the scan:
This works:
Oops! This might not give you what you intended as only half the term is commented:
Pay attention to long lines to distinguish between a long line that wraps vs a line that is broken across multiple lines.
And remember to watch those 'and' / 'or' clauses. Sometime a comment in the wrong place will give you syntax errors like we have in this example. Here the scan engine sees the 'and' at the end of the first line and expects another search clause, but in this case there is none and you'll get an error.
Note that in the scan results, your comments do not display: