"code":-4014,"msg":"Price not increased by tick size."

Hi everyone,
for now i am calculating my order quantity by this forumla:
orderQuantity = (margin * leverage) / symbolMarketPrice;

my margin is 5 usdt it’s working sometimes but sometimes don’t how can i stabilize this formula?
also when open long pos for DOGEUSDT it’s giving 500 quantity but when i open short pos it’s giving about like 700 quantity how can i calculate all this things, help me please i am stuck?

"code":-4014,"msg":"Price not increased by tick size."

This error message is related to the symbol filters returned from the exchangeInfo endpoint, the price and the quantity of an order needs to follow those filter rules to be submitted successfully.
You can consult more explanation on the Binance API Documentation, specially the tickSize field.

As for the quantity returning 500 or 700, I’m afraid this is beyond our support, as it’s related to how you’re building your formula and a matter of local debugging and rechecking.