Thinkorswim Strategies Complex Stop Management 6


Thinkorswim Strategies Complex Stop Management

A brief article to contain my recent experience trying to program a transitional stop management into a Strategy on the Thinkorswim platform. The client wished to have the initial stop based on existing price structure. Then after unrealized profit equaled initial risk, the stop would be passed onto some other tool. After several hours of what I not so affectionately refer to as “coding wack-a-mole”, I took a couple of days off to refresh my perspective. When I came back to the project it suddenly dawned on my what I was fighting against, and realized I didn’t have the firepower to overcome. Not yet anyway.

For more information about developing Strategies on Thinkorswim and analyzing the output please review the following posts:

 

The Limitations:

Here is a not so brief description explaining the hazards of coding a complex stop management into a Strategy in Thinkorswim. The placement of theoretical orders of a strategy are very difficult to predict. The key to understanding this, we’ll call “potential entry”. The code may sprinkle dozens of “potential entries” throughout the chart while the Strategy may only use half of them.

It can only hold a single position at a time. While a theoretical position is open, you may encounter a new “potential entry” in the code. Which would reset all the trailing stop parameters. Chaos ensues as the code is completely unaware that the Strategy already has an open position and that particular entry is being ignored.

Case in Point:

You have two entry signals within several bars. On which one does the Strategy place the Theoretical order? First? Second? Both? Or None? Well that depends on whether there is a current open position, and the conditions used to exit the position. Not to mention the potential for opposing entry signals. Change a few of the variables and you can see any one of those four outcomes.

What is Lacking:

Which makes it extremely complex to write code to manage stops. In other platform languages, the code has access to position status. The code can be aware of long, short and trade size. Not to mention portfolio equity. Thinkorswim is severely limited in this regard. But it does a great job considering how much it costs. The other factor is the way Thinkorswim implements a Strategy. Everything is modular. You are able to use one piece of code for your long entries, another piece of code for your short entries, and then use entirely different pieces of code to manage the exits. It’s designed to let you mix them around like Lego’s.

Looking Forward:

I do have some vague idea that one could build a sort of framework. A framework that could unify the entries and exits and keep track of current position type and status. But my mind is a long way off before that vague idea becomes a reality.

 


About Pete Hahn

For those trying to contact me about our professional services you will find all those details here: https://www.hahn-tech.com/about/ Any questions not related to our professional services or premium indicators should be directed to the comment section of the applicable video or you may post a question in our Q&A Forum: https://www.hahn-tech.com/thinkorswim-forum-topics/

Questions? Comments? Post a review?

6 thoughts on “Thinkorswim Strategies Complex Stop Management

  • LunvrSolace

    Have you seen what happens if you only allow no more than 1 trade in a single direction in the global strategy settings? Also have you tried writing the condition as Sell to close = price EntryPrice; this way it closes when there’s decrease in price over a certain amount of candles, but only if the trade is profitable.

  • SURESH VEnkat

    hi Pete, any thoughts on taking complex stop management into a strategy? I’m lacking on RIsk management and would like to see signals plotted either based on close below VAP or Pivot moving average or both.

    • Pete Hahn Post author

      Both of those can be achieved, yes. There is nothing complex about using either of these tools for your stop method. As described in this article, complex stop management is when we begin using one stop method, then at some point during the open position we transition to a different stop method.

      • Jay Amin

        Hi Pete,
        I just came across your videos, and love them and learning a lot from them. However, I do have a question. I was watching your video titled “Thinkorswim AutoTrade Almost”. so I have my buy criteria set and they function just fine, however, for sell i want to put condition as closing price of current candle is below 10% of previous candle. How can I write that in thinkscript. I have tried to research the % change function but my understanding is limited at this point it seems like.

        Thank you for helping people like me by creating very informative videos and posts here.

      • Pete Hahn Post author

        Far too complicated to explain in the comments section of a video. Best to post your request in the Q&A forum.