Handling of manually sending orders

Created at 25 Nov 2013, 13:31
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!
IR

Irfan

Joined 25.11.2013

Handling of manually sending orders
25 Nov 2013, 13:31


Hi,

Is it possible to handle manually sending orders through code?If possible please help me out .


@Irfan
Replies

illicoIt
25 Nov 2013, 14:01

Handling of manually sending orders

Yes. You can loop over the account positions.

 

foreach (var position in Account.Positions)
            {

                if (position.Label == "MyRobot")
                {
                    Print("on a trouve une position du robot " + position.TradeType + " time =" + position.EntryTime + "price = " + position.EntryPrice + "label" + position.Label);

                    _position = position;
                    break;
                }
            }

 

Then, your question is may about how to distinguish manually created position from the positions created by the robot. Can do this simply by libelling the robot created postion like this :

  var request = new MarketOrderRequest(TradeType.Buy, Volume) 
            {
                Label = "MyRobot"
            };
            Trade.Send(request);

 


@illicoIt