Partial Close Failing with error ,"15/08/2019 12:34:01.331 | → Failed to close position PID33725619 with error "Order closeVolume 0.20 is not multiple of volumeStep=39000.00."

Created at 16 Aug 2019, 07:54
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
VertoTrading's avatar

VertoTrading

Joined 18.06.2018

Partial Close Failing with error ,"15/08/2019 12:34:01.331 | → Failed to close position PID33725619 with error "Order closeVolume 0.20 is not multiple of volumeStep=39000.00."
16 Aug 2019, 07:54


Hi there,

i am having an issue with the Partial Close. I am wanting the trade to close out 50% of the trade, but it keeps giving the following error

| → Failed to close position PID33725619 with error "Order closeVolume 0.XX is not multiple of volumeStep=XXXXXX.00."

The Code that it is using is as follows:

 

PositionSize = Math.Round(position.Quantity * (MultiTradeLotClose / 100), LotDigits);
                        double LotStep = Symbol.VolumeInUnitsToQuantity(Symbol.VolumeInUnitsStep);
                        double steps = PositionSize / LotStep;
                        if (Math.Floor(steps) < steps)
                        {
                            PositionSize = Math.Floor(steps) * LotStep;
                        }

Have i got the wrong variables to convert it to a volume? Any help on this would be great.


@VertoTrading
Replies

VertoTrading
16 Aug 2019, 17:28

Never mind i got it sorted. Didn't read the API Refernce properly and i had it reading a lot not a volume value.


@VertoTrading