OCO Sell order with Stop Loss and Target Profit Limit Orders

sule4

New member
I know how to define OCO Sell order with Limit (upper, Target Profit price) and Stop Loss (lower limit) using ToS UI. They serve me well in my OnDemand and Paper trading, as before the trading day begins I walk through my current opened positions and add manually OCOs for each stock.
However, I'd like to automate OCO definition in ThinkScript, as most of the days I have multiple stocks opened. Setting of the OCOs for multiple opened position before every new trading day becomes tedious routine that I'd like to automate.

What I need for the start is the ThinkScript code/syntax for the OCO sell order in my case. I looked around but did not find what I needed. I tried ChatCPT but it gave me the code that editor complains about with "No Such Constant: OrderType.LIMIT_SELL"...etc.

Thank you for your help!
MS
 
Solution
If this is intended for live orders, you can't. This only works for strategies and back testing. Conditional orders would be the closest thing, but those would also have to be setup individually.
If this is intended for live orders, you can't. This only works for strategies and back testing. Conditional orders would be the closest thing, but those would also have to be setup individually.
 
Solution

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

I know how to define OCO Sell order with Limit (upper, Target Profit price) and Stop Loss (lower limit) using ToS UI. They serve me well in my OnDemand and Paper trading, as before the trading day begins I walk through my current opened positions and add manually OCOs for each stock.
However, I'd like to automate OCO definition in ThinkScript, as most of the days I have multiple stocks opened. Setting of the OCOs for multiple opened position before every new trading day becomes tedious routine that I'd like to automate.

What I need for the start is the ThinkScript code/syntax for the OCO sell order in my case. I looked around but did not find what I needed. I tried ChatCPT but it gave me the code that editor complains about with "No Such Constant: OrderType.LIMIT_SELL"...etc.

Thank you for your help!
MS
@Joshua is correct. ToS provides no ability to automate trade entry or exit.
Your OCOs need to be set up manually for each trade.
 
Last edited:
Saving Custom OCO templates may help you.

I've been experimenting and practicing trading futures with using Active Trader with Monkey Bar charts with OnDemand.

You can setup and save custom OCO templates .

This is an example of a market order with a set number of ticks but you can use % too:

OCO Template.png



OCO Setup.PNG
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
627 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