What is the right equation for specifying Limit and Stop prices of OCO sell order?

I’m struggling to make ALL my OCO sell orders placed successfully. Some of the OCO sell orders were placed successfully and some are not.

The error I’m getting:

  "code": -1133,
  "msg": "'stopPrice' was zero."


I know the rule is => Limit price > Last price > Stop price
But I’m missing the right EQUATION :disappointed_relieved:

What I’m doing is this…

I choose a symbol that matches my scalping criteria and fetch the symbol (stepSize & minQty) from exchangeInfo endpoint and do an equation I found on the Internet but it didn’t work for me as you can see, I modified it a little bit. Still not working.

Could someone share with me clear steps to implement to avoid this issue?
I’m using Node js if you would mind knowing.

Appreciate your help and thanks a lot!

Check your algorithm and ensure that your rounding is done correctly.