Is it possible to place two addorders?

PlusEVTrades

New member
I'm trying to code in multiple buy orders which would be the same criteria. Is it possible to have identical buy orders?

If I put in the same addorder code twice it doesn't seem to work.

Same with sell orders. In the case of sell orders they are different sizes. Is it possible to sell partial? When I have an open position or 100 shares and the code calls to sell 50, it still closes 100.
 
@PlusEVTrades Yes, you can have multiple Buy and/or Sell AddOrders() but they cannot have the same criteria... I'm also fairly certain that you can only have one active Buy order in a Current Strategy iteration meaning that once a Buy order fires you cannot have another trigger until a Sell order has fired... Also, make sure you have your global settings configured for multiple orders... This may allow multiple active orders...
 
You can also play around with the "Global strategies settings..."

4rGfY49.png
 
@PlusEVTrades Yes, you can have multiple Buy and/or Sell AddOrders() but they cannot have the same criteria... I'm also fairly certain that you can only have one active Buy order in a Current Strategy iteration meaning that once a Buy order fires you cannot have another trigger until a Sell order has fired... Also, make sure you have your global settings configured for multiple orders... This may allow multiple active orders...
I do have the global order settings set for multiple orders, regardless of where the order comes from.

I tested modifying the 2nd buy order to be different but that doesn't seem to work either, however, the 1st buy order can fire more than once if the criteria is met again separately. That is also before any sell order has fired. Functionally, it seems like it's capable. It adds to my position (Say 100 to 200 shares), but it doesn't like to work with separate buy orders. Similarly each sell function does work but they ignore the share size parameter for some reason.

This is the order code

Code:
AddOrder(OrderType.BUY_TO_OPEN, rsi is less than over_sold, diff crosses above 0, tickcolor = GetColor(0), arrowcolor = GetColor(0), name = "BUY1");

AddOrder(OrderType.BUY_TO_OPEN, rsi is less than over_sold, diff crosses above 0.01, tickcolor = GetColor(0), arrowcolor = GetColor(0), name = "BUY2");

AddOrder(OrderType.SELL_TO_CLOSE, entryPrice()-.10 or entryPrice()+.20, open[-1], 100, tickcolor = GetColor(1), arrowcolor = GetColor(1), name = "Sell1");

AddOrder(OrderType.SELL_TO_CLOSE, diff crosses below 0, open[-1], 100, tickcolor = GetColor(1), arrowcolor = GetColor(1), name = "Sell2");


The goal is... and maybe they are achievable in a different way...essentially to do a partial sell of an open position, say at 20 cents. And let the remaining position continue until different criteria are met. The only way I've been able to do this is separate the strategy into 2 with the separate sell orders onto different charts, it won't work on the same chart even.
 
@PlusEVTrades Yes, Sell orders cannot be broken up and will close the entire position regardless of what you use for trade size... So it seems like you can have multiple Buy orders from the same criteria only and Sell orders close the entire position... Limitations of the Strategy module I'd assume... After all, it's only for backtesting strategy logic but not full-fledged trading systems...
 

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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