[backtest bug] ModifyPosition and Commission 3.0

Created at 30 May 2018, 01:08
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!
dleeeq8's avatar

dleeeq8

Joined 03.08.2017

[backtest bug] ModifyPosition and Commission 3.0
30 May 2018, 01:08


hi ..

i see bug in the new API in 3.0

ModifyPosition(position,volume)

 

the bug is:

backtest dont count Commission

see:

 

the project for test:

 

using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;

namespace cAlgo.Robots
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class test : Robot
    {
        [Parameter(DefaultValue = 0.0)]
        public double Parameter { get; set; }

        protected override void OnStart()
        {
            Position p = ExecuteMarketOrder(TradeType.Buy, Symbol, Symbol.VolumeInUnitsMin, "", null, 1).Position;
            ModifyPosition(p, p.VolumeInUnits * 2); // double volume
        }

        protected override void OnTick()
        {

        }

        protected override void OnStop()
        {
        }
    }
}

 


@dleeeq8
Replies

PanagiotisCharalampous
30 May 2018, 11:07

Hi dleeeq8,

Thanks, we will investigate.

Best Regards,

Panagiotis


@PanagiotisCharalampous