Click here to Login




How to run a screen or a watchlist from a script

Updated on 2012-04-16





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).

Another example:

ScreenTask task = Screener.Run("Basic");
while(!task.IsCompleted)
{
App.Main.Sleep(500);
}

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:

string[] symbols = Watchlist.GetSymbols("Basic");

Assuming the watchlist name is "Basic".








2 comments (Log in)

Back







QuantShare
Product
QuantShare
Features
Create an account
Affiliate Program
Support
Contact Us
Trading Forum
How-to Lessons
Manual
Company
About Us
Privacy
Terms of Use

Copyright © 2012 QuantShare.com
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Google+
Follow us on Google+
RSS Trading Items