La ordenes de take profit y stop loss no se cierran automáticamente con el precio

Hello good, my name Juan

I am working with the node-binance-api-ext and I am creating orders like this:

// create limit buy order
binance.futures.buy(“BELUSDT”, 10, 1.127);

// take profit limit sell order (but if price reach faster it will be short limit sell)
// so better to create it afte position created
binance.futures.sell(“BELUSDT”, 10, 1.13);

// create stop loss
binance.futures.stopMarketSell(“BELUSDT”, 10, 1.12);

I create the orders with its stop and take profit, the problem is that if the entire take profit price closes the order and the take profit well but the stop loss is not closed and vice versa if the stop is touched, the take does not close.

I have tried with the One-way position mode and nothing, I have tried with the hedge mode and neither.

I have tried switching to Hedge Mode mode like this by saying the order direction:

// or in case you have enabled hedge mode you need directly use positionSide
binance.futures.buy(“BTCUSDT”, 0.001, 18000, { positionSide: “LONG” });
binance.futures.sell(“BTCUSDT”, 0.001, 18000, { positionSide: “LONG” });
binance.futures.stopMarketSell(“BTCUSDT”, 0.001, 17000, { positionSide: “LONG” });

Using the Hedge Mode and the positionSide but in the same way it does not close the positions when it reaches the price, again it closes the take or stop well if it touches but the opposite does not always leave an open position.

Does anyone have a solution to this problem.

Thank you all in advance, I’ve been trying and trying a thousand things for hours and I can’t.

Thanks and best regards.

Sorry for my English, I use a translator, but I don’t speak English


Hola buenas, mi nombre Juan

Estoy trabajando con la node-binance-api-ext y estoy creado ordenes de esta forma:

// create limit buy order
binance.futures.buy(“BELUSDT”, 10, 1.127);

// take profit limit sell order (but if price reach faster it will be short limit sell)
// so better to create it afte position created
binance.futures.sell(“BELUSDT”, 10, 1.13);

// create stop loss
binance.futures.stopMarketSell(“BELUSDT”, 10, 1.12);

Creo las ordenes perfecto con su stop y take profit, el problema es que si el precio toda take profit se cierra bien la orden y el take profit pero no se cierra el stop lossy al revés si toca stop no cierra el take.

He probado con el modo de posición unilateral y nada, he probado con el modo de cobertura y tampoco.

He probado a cambiar al modo de cobertura de esta manera diciendo la dirección de la compra:

// or in case you have enabled hedge mode you need directly use positionSide
binance.futures.buy(“BTCUSDT”, 0.001, 18000, { positionSide: “LONG” });
binance.futures.sell(“BTCUSDT”, 0.001, 18000, { positionSide: “LONG” });
binance.futures.stopMarketSell(“BTCUSDT”, 0.001, 17000, { positionSide: “LONG” });

Usando el modo de cobertura y el positionSide pero de igual manera no cierra las posiciones cuando cuando alcanza el precio, de nuevo cierra bien el take o stop si toca pero la contraria no dejando siempre una posición abierta.

Alguien tienen una solución a este problema.

Muchas gracias de antemano a todos, llevo horas intentando y probando mil cosas y no lo consigo.

Gracias y un saludo.

Please translate it to English so we could help you

Sorry for my English, I use a translator, but I don’t speak English, thanks for your help

Still have hard time understanding your words translated from translator…
Do you have problem with binance.futures.stopMarketSell(“BELUSDT”, 10, 1.12)? Did you place the order successfully?
Use below to print out the information for debugging
binance.futures.stopMarketSell(“BELUSDT”, 10, 1.12).then(resp=>console.log(resp)).catch(err=>console.log(err))

Yeah - The TP/SL function on the web page is not available thru API;
If you have one TP and one SL order at the same time, and if either one gets triggered and filled, you need to cancel the other one manually;
Hope I answered your question

If the order is made in a correct way, take profit and stop loss are being placed correctly.
But when take profit or stop loss is closed, it’s not being closed the opposite order. And the idea is to close the both orders at the same time.

If i do the same process from the binance panel, take profit and stop loss orders are correct, and if it one of the orders are closed, automatically the opposite order gets closed too.

the order created from the api

take the stoploss looks like this:

ok thank you very much for your help I understand that I have to do it by hand.