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.
 

rad14733

Well-known member
VIP
@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...
 

BenTen

Administrative
Staff
VIP
You can also play around with the "Global strategies settings..."

4rGfY49.png
 

PlusEVTrades

New member
@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.
 

rad14733

Well-known member
VIP
@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...
 

Similar threads

Top