The script editor has now two additional variables that allow you to start, run and get signals from a screen or watchlist programmatically.
Steps
- Select "Tools" then "Script Editor"
- Select "File -> New" then type the name of your script
- Type the following code then click on "Execute" (menu)
Screener.Open("Basic"); // Open and run a screen
This will open the screener tool and run a screen called "Basic". (Change "Basic" with your screen name).
for(int i=0; i< task.ScreenResults.Length;i++)
{
string symbol = task.ScreenResults[i].Symbol;
}
The above example allows you to get a list of symbols that meet the screen criteria. The second instruction ("while") is used to wait until the screen work is completed. Once the work is done, we loop thought screen results and extract the symbol name from each result.
You can also get symbols from a watchlist by executing the following code: