Using thinkscript to close all open positions


Category:
0
0

Hi I am wondering if it is possible to use thinkscript to close all my open positions when my “Net Liquidation” falls to a certain value ?

So its like thinkscript will loop through all my open orders, if its a buy order, then sell at market. And if it is a sell order, then buy at market. Thanks for your answer.

Marked as spam
Posted by (Questions: 1, Answers: 0)
Asked on June 15, 2021 10:07 pm
762 views
0
Private answer

I moved your question out of the "Alerts and Notifications" topic and into the "Strategies" topic.

What you have requested is 100% completely impossible to do using Thinkorswim programming language. The language in Thinkorswim is not able to loop through open positions, nor is it able to automatically close positions. In regards to automation, the full and complete guide to what IS currently possible is demonstrated in the following video:

https://www.hahn-tech.com/thinkorswim-autotrade-almost/

The most appropriate way for you to handle what you have described here is to have your brokerage account setup to automatically close all open positions when net liquid reaches a certain threshold. This is something that should be handled at the brokerage level and there are brokers out there that provide this as part of their service. Whether or not TD Ameritrade provide this service, I do not know. But you should be discussing this with TD Ameritrade. And if they do not have this service, and this sort of feature is crucial to your trading success, then you should be shopping around until you find a brokerage that does provide this feature.

Marked as spam
Posted by (Questions: 37, Answers: 4084)
Answered on June 16, 2021 8:41 am