• Get $40 off VIP by signing up for a free account! Sign Up

Is it possible to exit a trade in the same candle

beginner_in_need

New member
Hello,

I need help with something pertaining to exiting my trades. Is it possible to exit a trade in the same candle as it was entered if exit condition is true? At the moment, my entries and exits are working very well but it starts "looking" for the exit condition on the next candle. I wish for it to do so starting from the entry candle.
 
Last edited by a moderator:
Solution
Hello,

I need help with something pertaining to exiting my trades. Is it possible to exit a trade in the same candle as it was entered if exit condition is true? At the moment, my entries and exits are working very well but it starts "looking" for the exit condition on the next candle. I wish for it to do so starting from the entry candle.

If you have written your AddOrder statements correctly. Then yes, you will see sometimes see entries and exits on the same candle.

However, it "sounds" like you have bad syntax and your code has a repainting AddOrder statement.
IE: an AddOrder that is not posting the entry on the next candle, where the exit would also then be posted.

Make sure you are placing your AddOrders on...
Hello,

I need help with something pertaining to exiting my trades. Is it possible to exit a trade in the same candle as it was entered if exit condition is true? At the moment, my entries and exits are working very well but it starts "looking" for the exit condition on the next candle. I wish for it to do so starting from the entry candle.

If you have written your AddOrder statements correctly. Then yes, you will see sometimes see entries and exits on the same candle.

However, it "sounds" like you have bad syntax and your code has a repainting AddOrder statement.
IE: an AddOrder that is not posting the entry on the next candle, where the exit would also then be posted.

Make sure you are placing your AddOrders on open[-1]
The results will make you much sadder. But they are the only realistic P&L results available when backtesting using the ToS platform.

Here is why:
The ToS platform does not have the ability to store intra-candle tick activity. The only way to know what the final close that the P&L results will be calculated on, is to wait until the open of the next candle. open[-1]

Sounds like you are using the close of the current candle. This causes the AddOrder statement to go back to that prior candle and repaint your entry after the candle closes.
But you can't do that. You can't wait until the horse ran the race and then go back in time and bet on him.
 
Solution

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
262 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