Doesn't private Position position work anymore?
Created at 11 Dec 2013, 20:21
OL
Doesn't private Position position work anymore?
11 Dec 2013, 20:21
Hi when i use the new ExecuteMarketOrder insted of Trade.CreateBuyMarketOrder the robot doesn't follow the code inside protected override void OnPositionOpened(Position openedPosition)
Does anyone know how i can fix this ?
Thanks
Spotware
12 Dec 2013, 09:45
ExecuteMarketOrder uses synchronous operation and you will need to subscribe a callback like in the following example if you want a method to be called when the position opens. This callback method will be called each time a position opens by the robot or manually.
Instead of declaring a field for position you can use Label to identify the position opened by the robot, so that in the event the robot is restarted it can continue operation knowing the positions that it opened. Please read the following section: /forum/whats-new/1937
To find positions by label you can use position.Find and position.FindAll.
See /api/positions
@Spotware