♥ 0 |
I have a scanner from a friend that scans for specific options that meet a few criteria and then of course sends them to a watch list. The list has the option specific ticker instead of the underlying stock symbol…for example UBER200207C33 What I would like to do is automatically run that list through another scanner for financials criteria or other studies. The issue of course is you can’t scan option symbols like that … is there a way within TOS to take a list like that and have it know that it is UBER and scan the main ticker for the new criteria? Sorry if I am not explaining myself very well
Marked as spam
|
Private answer
There is a function within the Thinkorswim language which enables us to pull the underlying ticker symbol. However I'm not sure how you plan to use this so all I can do is provide an example which displays the underlying symbol in a custom watchlist column:
So the key to this is the function named GetUnderlyingSymbol(). This function returns a string value. This mean we cannot assign the output of that function to any variables. You can only use it within other functions which take a string input parameter for 'symbol'. Here is another example which would display the current price of the underlying ticker symbol in a custom watchlist column:
You can also assign that to a variable:
This will enable you to use the close of the underlying ticker symbol elsewhere in your code. If you wanted to take that list of ticker symbols from the first example and use that as the foundation for another scan. You would need to export that to a .csv file where you can extract your ticker symbols and import them into a new personal watchlist. Again, you left out the most important details of your specifications. Which is what scan you wanted to run against this list of OPRA codes. You could take that original watchlist of OPRA codes and run the follow scan directly:
This technique will work with all the fundamental data elements of the chart: Open, High, Low, Close, Volume etc... A complete list can be found here: https://toslc.thinkorswim.com/center/reference/thinkScript/Constants/FundamentalType So yes, with a bit of creativity you can compute just about any of the technical indicators within your scan. Converting the OPRA codes into underlying ticker symbols, assigning each to a variable and then use those variables to compute the indicator. For example you can compute the ATR study like this:
Be sure to test individual components of your scan before going all out and writing the full script. This may have some bugs when running scans while the options market is closed. Can't do anything about that. Marked as spam
|
Please log in to post questions.