Error with multiple diferent Take Profits

 

Hello.


I am having a problem when opening 2 diferentes orders at the same time, but with diferent take profit


Order 1: Volume of 3, with TP at 150000 (I just put a high value to test this case, and show the error)

Order 2: Volume of 1, with TP at 91885


Buy price of both orders at 91825.


When the price hits 91885, all the 4 positions where sold by the Take Profit (as show on the screenshot). Can I open 2 diferent orders with 2 diferent take profits? Am i doing something wrong?


Here is the code that open the orders:


trade.Buy(batchSize - partialBatchSize, Symbol(), buyPrice, stopLoss, 150000, "Compra sem TP");
trade.Buy(partialBatchSize, Symbol(), buyPrice, stopLoss, takeProfit, "Compra TP");


Any help would be very appreciated.


Thanks!

Files:
 
matheusgs05 :

Hello.


I am having a problem when opening 2 diferentes orders at the same time, but with diferent take profit


Order 1: Volume of 3, with TP at 150000 (I just put a high value to test this case, and show the error)

Order 2: Volume of 1, with TP at 91885


Buy price of both orders at 91825.


When the price hits 91885, all the 4 positions where sold by the Take Profit (as show on the screenshot). Can I open 2 diferent orders with 2 diferent take profits? Am i doing something wrong?


Here is the code that open the orders:



Any help would be very appreciated.


Thanks!

Yes, you are making a typical mistake - you are trying to trade on a NETTING trading account as on a HEDGE trading account. Read the help: 

Basic Principles

Netting System

Hedging System

Basic Principles - Trading Operations - MetaTrader 5 Help
Basic Principles - Trading Operations - MetaTrader 5 Help
  • www.metatrader5.com
is an instruction given to a broker to buy or sell a financial instrument. There are two main types of orders: Market and Pending. In addition, there are special Take Profit and Stop Loss levels. is the commercial exchange (buying or selling) of a financial security. Buying is executed at the demand price (Ask), and Sell is performed at the...
 
Hello Vladimir. Yes, I requested to the broker change my account to Hedge, and now everything works fine. Thansk for you help!!