PositionsOnClosed with ClosePosition

Created at 02 May 2018, 09:03
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!
YO

yoannes

Joined 05.02.2017

PositionsOnClosed with ClosePosition
02 May 2018, 09:03


Hi,

I tried to close the position partially with 

ClosePosition(Position position, long volume)

However, when setting the volume its not calling the method below. It just works when closing the position it self.

protected override void OnStart()
{
    Positions.Closed += PositionsClosed;
}
private void PositionsOnClosed(PositionClosedEventArgs args)
{
    var position = args.Position;
    Print("Position closed with {0} profit", position.GrossProfit);
}

 

Am I missing something? Is there a way of getting a callback of the volume closed?

Thanks


@yoannes
Replies

PanagiotisCharalampous
07 May 2018, 14:17

Hi yoannes,

Try  Positions.Modified event.

Best Regards,

Panagiotis


@PanagiotisCharalampous