Stop loss based on closing price

ayzee

New member
I like to set a stop loss related to my stock purchase price, i.e., sell the stock if it closed 2% less than what I paid for it.
The stop loss should be based on the "close" of the previous day (and not intra-day price).
This thinkscript condition sold the stock during the trading day I bought:
close[1] is less than EntryPrice() * 0.98

I entered above in: Order Entry (STOP) -> Order Rules -> Conditions (I did not use AddOrder(..)).

Thanks in advance.
 
@ayzee Welcome to the usethinkscript forums... So which is it, 2% less than entry price or 2% less than previous days close...??? A simple % based stoploss is built into Thinkorswim... As you have discovered, if you want stoploss based on yesterdays close you would need a Conditional Order which may have less chance of executing based on recent comments... You could always manually calculate the 2% from yesterdays close and enter that as your stoploss, unless you are talking about a trailingstop... Perhaps a bit more clarification would help us help you...
 
@rad14733, thanks for response and for your suggestion to manually alter the stoploss.
However, I do not want to have to adjust the stop manually/frequently. Rather, I like to programatically sell at stoploss. E.g., if today it closes at a price less than 2% of its entry price, then I must sell it. How should I modify the following condition: "close[1] is less than EntryPrice()*0.98", or is there a better command?

(PS: I have good programming experience in languages other than thinkscript).
 
Last edited:
Unfortunately, from experience, EntryPrice() doesn't work in Conditional Orders... A better method is to manually edit the Conditional Order and adjust your entry price... From there you can continually monitor close[1] with the exception that secondary aggregations aren't allowed in Conditional Orders either... Lots of roadblocks within Thinkscript, as you have no doubt encountered... After programming in other languages it feels that our hands are tied behind our backs...
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
459 Online
Create Post

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top