PositionCloseReason

Created at 01 Mar 2019, 22:59
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!
alexander.n.fedorov's avatar

alexander.n.fedorov

Joined 02.01.2018

PositionCloseReason
01 Mar 2019, 22:59


Dear Panagiotis,

How could you use 

PositionCloseReason.TakeProfit

 

Regards,

 

Sasha


@alexander.n.fedorov
Replies

PanagiotisCharalampous
04 Mar 2019, 10:36

Hi Sasha,

See below

        protected override void OnStart()
        {
            Positions.Closed += Positions_Closed;
        }

        private void Positions_Closed(PositionClosedEventArgs obj)
        {
            if (obj.Reason == PositionCloseReason.TakeProfit)
            {
                // Execute market order
            }
        }

Best Regards,

Panagiotis


@PanagiotisCharalampous