I am checking for some signals and when the counter reaches 8 it sends a BUY / LONG position.
System.out.println(syncRequestClient.postOrder(“ETHUSDT”, OrderSide.BUY, PositionSide.LONG, OrderType.MARKET, null,
“0.003”, null, null, null, null, WorkingType.MARK_PRICE, NewOrderRespType.RESULT));
At this point a position is opened and everything is allright. Now I want to close the position by reaching a specific Marker Price. You could say I want to place a take profit order.
To close the position you wrote in an other thread that I should place a SELL order. So I use the postOrder function again and SELL the LONG position using the postOrder function below.
System.out.println(syncRequestClient.postOrder(“ETHUSDT”, OrderSide.SELL, PositionSide.LONG, OrderType.TAKE_RPOFIT_MARKET, null,
“0.1”, null,null,null, “2200.00”, null, null));
Order postOrder(String symbol, OrderSide side, PositionSide positionSide, OrderType orderType,
TimeInForce timeInForce, String quantity, String price, String reduceOnly,
String newClientOrderId, String stopPrice, WorkingType workingType, NewOrderRespType newOrderRespType);
The error message is that it would trigger immediately. When I change some parameters the error message is that the order type is invalid.