Script to Sell at Close of Current Candle...

BrokeTeacher

New member
Hello everyone,

What I am looking for seems like something that should be a TOS default, yet I have done hours of searching and contacted TOS Trader Support twice - no one seems to know how to do this (I received two scripts and neither works). The script I am looking for would simply Sell a stock, at Market, at the end of the current candle. Specifically, I would like:

~ A custom script I can enter as a Condition, for a stock I already own, to Sell at Market
~ The Sell occurs when the current candle I am using for the stock (ex: 10-minute candle) ends (ex - 10:09.59 AM)

Complete example: I Buy a stock at 10:00AM with a Sell Condition, custom script, to Sell at Market when the current 10-minute candle ends at 10:09.59 AM.

I am certain one of the great creators on here can probably do this in his/her sleep, but know that you would be the first.

I want to now how to Sell a stock right before a candle ends. Would you please let me know how I could clarify this more? I would greatly appreciate a solution to this question, so I am willing to provide whatever clarity is needed.
 
Last edited by a moderator:
Thank you for the directions! Unfortunately, I am not sure how to make this clearer... I do not see how a screenshot would clarify how to Sell a stock right before a candle ends. Would you please let me know how I could clarify this more? I would greatly appreciate a solution to this question, so I am willing to provide whatever clarity is needed.

the only way to do something when a candle closes, is to do it on the next candle.

if a trigger is used during a candle, the active candle, it may occur multiple times. you can't force a variable to act on the first trigger during a candle and ignore others during that candle.

that is why addorder has a default of buying with open[-1] , it triggers after the signal candle is closed. so multiple buys and sells do not happen.

maybe looking at examples with addorder will help.
i don't use code in conditional orders, so am not sure what is possible.

ref. addorder
https://tlc.thinkorswim.com/center/reference/thinkScript/Functions/Others/AddOrder
 

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

I want to now how to Sell a stock right before a candle ends.

Wouldn't that be a neat trick!
But no, it is not possible to aggregate data "intra-candle".
No, it is not possible to "Sell a stock right before a candle ends."

The workaround would be to use a lower timeframe, so you are not waiting as long for the candle to close.
.
 
Last edited:

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
520 Online
Create Post

Similar threads

Similar threads

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