ModifyPosition(buyposition, 10000) faulty

Created at 30 Jul 2018, 11:33
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

ModifyPosition(buyposition, 10000) faulty
30 Jul 2018, 11:33


Hi,

When Modifying volume  by reducing it from say 20000 to 10000 (by half) it works perfectly. but when you reduce it by more or less than half it fails to make sence.

 

If 0.4 lot has a net profit of say 40$,

closing 0.2 lot should be 40$/2=20$ which works

closing 0.1 lot should be 40$/4=10$ but give wrong. also closing 0.3 lot is wrong etc

I expect  closing

 

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 NewcBot : Robot
    {
        public int i = 1;

        protected override void OnStart()
        {
            ExecuteMarketOrder(TradeType.Buy, Symbol, 40000, "x");
        }

        protected override void OnTick()
        {
            var buyposition = Positions.Find("x", Symbol, TradeType.Buy);
            if (buyposition.Pips > 20 && i < 2)
            {
                Print(buyposition.NetProfit + "   this is 0.4 Lot = 100%");
                ModifyPosition(buyposition, 10000);
                Print(buyposition.NetProfit + "  This  0.1 Lot & should be 25%");
                i += 1;
            }
        }
    }
}

Thank you


@ceakuk
Replies

ceakuk
30 Jul 2018, 11:37 ( Updated at: 21 Dec 2023, 09:20 )


@ceakuk

PanagiotisCharalampous
30 Jul 2018, 11:43

Hi ceakuk,

cAlgo team is arelady aware of this and working on fixing it.

Best Regards,

Panagiotis


@PanagiotisCharalampous

ceakuk
30 Jul 2018, 12:00

RE:

Dear Panagiotis,

Thanks for the reply. did you mean they have been working on it  before I sent the request or they saw it from my  request?

Thanks

 


@ceakuk

PanagiotisCharalampous
30 Jul 2018, 12:03

Hi ceakuk,

Yes we knew about it before the post. It is the same issue as https://ctrader.com/forum/whats-new/13492?page=1#8

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
23 Aug 2018, 15:02

Hi ceakuk,

We have released an update today that should have fixed this issue.

Best Regards,

Panagiotis


@PanagiotisCharalampous