Opened Positions using ExecuteMarketOrder
Created at 15 Jan 2014, 22:15
DI
Opened Positions using ExecuteMarketOrder
15 Jan 2014, 22:15
I've made a substition of Trade.CreateBuyMarketOrder(Symbol, volume); to
ExecuteMarketOrder(TradeType.Buy, Symbol, volume, "Robot2"); and after that the robot stopped reading all my
commands for opened positions.
This is how it recently is written:
protected override void OnPositionOpened(Position openedPosition)
{
}
How can I fix that?
Thank you.
Spotware
16 Jan 2014, 09:09
You will have to subscribe a method and define it like in the following code:
Note that the method will be called whenever a position is opened whether by this robot or else. So, you will have to check the position's label to make sure that it is the robot's position that is opened.
Alternatively, you can use the asynchronous equivalent method with a callback function.
See the what's new section on the new trading api as well as the guide.
@Spotware