Partial close is not supported in backtesting?

Created at 25 Feb 2015, 14:20
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!
NO

NonciAzzecco

Joined 08.12.2014

Partial close is not supported in backtesting?
25 Feb 2015, 14:20


I have received the following message during backtesting:

04/10/2011 19:23:00.000 | Crashed in OnTick with NotSupportedException: Partial close is not supported in backtesting

 

is that true?

Thank you


@NonciAzzecco
Replies

NonciAzzecco
25 Feb 2015, 16:17

RE:

NonciAzzecco said:

I have received the following message during backtesting:

04/10/2011 19:23:00.000 | Crashed in OnTick with NotSupportedException: Partial close is not supported in backtesting

 

is that true?

Thank you

I found some old post on this matter and many search on the forum lead to page error. That's not good! :(


@NonciAzzecco

Spotware
27 Feb 2015, 14:40

Partial close is not supported in backtesting. We plan to support it in the future.


@Spotware

leohermoso
01 Feb 2018, 03:44

RE:

Spotware said:

Partial close is not supported in backtesting. We plan to support it in the future.

When this is going to happen?


@leohermoso

PanagiotisCharalampous
01 Feb 2018, 09:43

Hi leohermoso,

This is planned for the next release of cAlgo which should be out really soon.

Best Regards,

Panagiotis


@PanagiotisCharalampous

AxiomQuant
11 Feb 2018, 16:15

RE:

Panagiotis Charalampous said:

Hi leohermoso,

This is planned for the next release of cAlgo which should be out really soon.

Best Regards,

Panagiotis

Hi Panagiotis,

that's great to hear as I also experienced the same error recently. Could you be more specific regarding what "really soon" means? Days? Would it be out during this month (February 2018)? I'm asking to know wheter I shall start implementing some workaround or just wait. Knowing that I would need to wait for more than one or two weeks is rather important for me.

Thank you


@AxiomQuant

fxwisdom1@gmail.com
01 May 2019, 06:19

RE:

Panagiotis Charalampous said:

Hi leohermoso,

This is planned for the next release of cAlgo which should be out really soon.

Best Regards,

Panagiotis

It's been 2 years and promise has not been made... why?


@fxwisdom1@gmail.com

bart1
01 May 2019, 09:21

Hi,

It works in backtesting with 

ModifyPosition(position, newVolume);

 


@bart1

seankiaa
30 Apr 2022, 23:49

I have been using: 

                ClosePosition(position, volume);

 

Could you clarify if this is supported in back test and has already been implemented?
 


@seankiaa

amusleh
02 May 2022, 08:49

RE:

seankiaa said:

I have been using: 

                ClosePosition(position, volume);

 

Could you clarify if this is supported in back test and has already been implemented?
 

Hi, Partial close is working fine, use ModifyPosition method:

using cAlgo.API;
using cAlgo.API.Internals;

namespace NewcBot
{
    [Robot(AccessRights = AccessRights.None)]
    public class NewcBot : Robot
    {
        protected override void OnStart()
        {
            var result = ExecuteMarketOrder(TradeType.Buy, SymbolName, Symbol.VolumeInUnitsMin * 2);

            if (result.IsSuccessful)
            {
                Print("Order successfully placed, modifying volume");

                ModifyPosition(result.Position, result.Position.VolumeInUnits / 2);
            }
            else
            {
                Print("Order placement failed");
            }
        }

        protected override void OnStop()
        {
            foreach (var position in Positions)
            {
                ClosePosition(position);
            }
        }
    }
}

 


@amusleh