I updated the title of your question to more clearly explain the context of your request. This is will assist others with similar questions to locate this post using the search fields.
Since you have posted this in the Strategy Guide topic I interpret that to mean your request is for a solution using the Conditional Order editor. So you are not actually talking about modifying an existing order that has already been submitted. Need to keep that clear so everyone understands the scope and application.
Having said that I can anticipate the next question that comes to mind. No, it is not possible to use any code in Thinkorswim to modify any order that has been submitted.
So what you need here is a very simple condition. You will enter a sell at market order and then access the Conditional Order editor. You can easily construct this without writing a single line of code.
Two screenshots below shows how to set it up. The blue spikes at the bottom are showing where the condition is true and the order would have been sent to market. Notice here I have used the close crossing below the low of the previous candle. In a live market this will execute on the first trade that occurs below the low of the previous candle. Even if the close of that candle later turns back above the previous candle’s low.
Great, Thanks.!