♥ 0 |
Hi Pete,
Thank you very much for all the great stuff. Really appreciate it.
I want to create a scan for option contracts traded at or above Ask price on TOS, came up with the code like this: PriceType.LAST is greater than or equals to PriceType.ASK, but it doesn’t work. Please help.
TIA
Marked as spam
|
Private answer
Based on the context of your request, I moved this post out of the "Frequently Asked Questions" topic and into the "Stock Scanners" topic. Two details I need to clarify:
Notice that there are several layers of orders in the ASK column. (this is valid for options, futures and stocks as all markets function exactly the same). It is not possible to execute an order above the lowest ASK price in that column. All prices must always execute at the ASK (for buy orders) or at the BID (for sell orders). Trying to scan for any instrument that trades above the ASK or below the BID is not congruent with the way healthy markets function. From the items you marked on your attached screenshot it seems you are not correctly interpreting the data that is displayed in that table. I suggest you contact the trade desk at TD Ameritrade to gain a clearly understanding of what that table displays. If I have made any statements that were not 100% correct, please report back in the comments section by providing the response you receive from TD Ameritrade.
The request has been clarified to: "the code to scan the trades that happened at ask" First I must say that this is completely impossible to do on Thinkorswim. This platform does not provide the granularity to run a scan at a "per trade" level. The best we can do is to base the scan on every trade that has occurred in the most recent 1 minute. (which requires the Study Filter of the scan be set to 1 minute). As I understand the true question no, I can say this is absolutely impossible to build on the current version of Thinkorswim. Now that I have cleared that up. I can offer some troubleshooting advice. The author of the post has been writing various sections of code and is not able to get any results. The first thing we must understand is exactly how does Thinkorswim get the "ASK" price? We use one of the built-in fundamental data arrays, such as "open, high, low or close". Then we apply the PriceType constant of "PriceType.ASK". Details here: https://toslc.thinkorswim.com/center/reference/thinkScript/Constants/PriceType/PriceType-ASK Using the example given in the link above, we can test the scan engine of Thinkorswim to be sure it is even able to use this data point when we invoke it in our script. The following are three sets of scripts we can use to run some tests:
The first one runs a scan that checks of the opening ask price of the most recent candle is less than zero. Run this scan and it returns zero results. But we might expect the scan would not find any options with a value below zero, so lets make we check every possible value... The second one runs the same scan but checks if that opening ask price is greater than zero. Run that scan and you get no results. The third and final section of code checks if the opening ask of the most recent candle is any number at all. Again we get zero results. From this, we can confirm it is not possible to write any code for a custom scan that tries to reference the opening ask price of a candle. I'll let the viewers run this test for the other price types. For me this is enough proof that Thinkorswim developers have either intentionally or mistakenly prevented this feature from working in a custom scan of any kind. Anyone who might feel this is a bug or needs to be corrected should consider submitting this as a feature request or a bug report to TD Ameritrade support. Marked as spam
|
Please log in to post questions.