ClosePosition(position, partialVolume);

Created at 12 Jul 2018, 12:36
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!
CE

ceakuk

Joined 19.03.2018

ClosePosition(position, partialVolume);
12 Jul 2018, 12:36


I would like to partially lose my open positions

 ClosePosition(position, partialVolume);

However, back testing does not allow partial closing.  how can I use modifyposition() or alternatives

Thanks


@ceakuk
Replies

ap11
12 Jul 2018, 16:12

Hi Ceakuk,

In ModifyPosition you should specify desired volume you wish to have after position modification.

Here is an example on how to change volume from 20k to 10k:

var position = ExecuteMarketOrder(TradeType.Buy, Symbol, 20000).Position;
ModifyPosition(position, 10000);

Regards,
Andrey


@ap11

ceakuk
12 Jul 2018, 17:22

RE:

Thank you Andrey Pisarev


@ceakuk