Stock that halted
Author: gchudublin
Creation Date: 7/12/2018 5:05 AM
profile picture

gchudublin

#1
Is it possible to write a scanner in Wealth Lab Pro to find stock that just halted? I understand there is doc for writing a scanner. Just want to ask first.
profile picture

Eugene

#2
How do you precisely determine that a stock got halted i.e. what rule distinguishes a stock halt from a stock becoming illiquid? Or maybe there's an external data source you could use for detecting this? Answering these questions is the key before writing a scanner.
profile picture

Cone

#3
profile picture

Eugene

#4
Thanks Robert but this page is tricky for web scraping from a technical standpoint, making the resulting example code for @gchudublin a bit lengthy / challenging to read. Fortunately, they host a RSS feed for halts at http://www.nasdaqtrader.com/rss.aspx?feed=tradehalts so I managed to come up with a 10-liner as parsing RSS is trivial in .NET.

PREREQUISITES:

1. In the Strategy Editor, click "References..." and check System.Xml on the .NET Framework tab.
2. Switch to "Other assemblies...", click "Add a reference...", navigate to c:\Windows\Microsoft.NET\Framework64\v4.0.30319\ and add System.ServiceModel.dll

Code:

CODE:
Please log in to see this code.


@gchudublin

To improve script's performance I suggest caching the Halts() output in Wealth-Lab's global memory (GOP) and working with the cached copy. Otherwise my script makes an RSS request each time it runs. Server may penalize excessive requests by banning the user.

UPDATE

Here's a caching version. To reset the cache, make sure to either call ClearGlobals() in your script once a day or restart WLP.

CODE:
Please log in to see this code.


To automate GOP cleanup, a possible enhancement might be to save halt date (delivered in the RSS feed) and check whether it's current (no action required) or is out of date (and call ClearGlobals() then).
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).