Jump to content
Sign in to follow this  

Cannot Close Open Position (Consisting Multiple Orders ) Quantity value in 100's or 10's, like 75,120

Recommended Posts

I am trying to CLOSE an open position of EUR/GBP total Quantity 159000 which is accumulation of 4 separate ORDERs - attached ScreenShot.

Here is the JSON that I submit to "order/newtradeorder" API URL



I get the result with error : Status=2, Status Reason=75


Where Status Reason 75 = "The total quantity of guaranteed stop orders must be equal to trade
order quantity."

I have tested my Close Position API Calls and it works fine where the QUANTITY is like 123,000. If there are quantity in  Hundredth and Tenth position, like 123,450 Then my API Calls fails. Even though in this example TOTAL Quantity is 159,000 still it fails because the Individual Open Positions have quantity in Hundredths and Tenth position. 

How do I overcome this situation? Thank you.




Share this post

Link to post

Hi Superee,

There's been a slight confusion in the error codes you are using that has sent you on a slight wild goose chase. 

The first set of codes (in green below) are the InstructionStatus and InstructionStatusReason codes. It is the 2nd set of codes (in red below) that are the OrderStatus and OrderStatusReason codes. 158 = Price tolerance exceeded. 

I see your in your trade request that you are overriding the default value of 2 to zero. A value of zero makes your trade request a "Fill or Kill" (FOK) order request. This means execute the trade at the price I am seeing right now and only this price. If the price should move by even 1 pip then kill my order and nothing done. If you loosen the price tolerance back to 2, then you are more likley to have the trade executed, although you can have up to 2 points of slippage.

Note: if you are attempting to trade during volatile periods when the prices are moving very fast, you can still receive a 158 even with a price tolerance of 2. 

Kind Regards, PM



Share this post

Link to post

Yes, I did read that PriceTolerance value "2"  is good to use in another post. Physicsman would using PriceTolerance inflate the price we are buying or selling?

Meaning if there are two trades, one with PriceTolerance set to 2 and another one set to 0. Would there be any price buy/sell differences between those trades?

Share this post

Link to post

Hi SirNewton,

The PriceTolerance does not change the prices you see at all. It only affects the potential prices you can be filled (trade executed) at. That is, with PriceTolerance = 2, you are allowing the system to fill you with up to 2 points of slippage, whereas a Tolerance of zero means fill me at the price I am seeing right now only.

Were the market price to have moved by even 1 point by the time the server receives your order request then the order request is rejected and no trade is executed.

Kind Regards, PM

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this