How to send multiple Market orders retrieving the details of each position before sending the next Market order
Joined 27.09.2012
How to send multiple Market orders retrieving the details of each position before sending the next Market order
01 May 2013, 09:14
Could you please give an example on how to send multiple market orders and retreive each position details before sending the next order.
for (int i=0;i<5;i++){
TradeType sell = TradeType.Sell;
var request = new MarketOrderRequest(sell, 10000)
{
Label = "Robot 1",
SlippagePips = 0,
StopLossPips = 10,
TakeProfitPips = 20
};
Trade.Send(request);
Retreive the position details here... like Id, EntryTime, Label... before sending the next order
}

cAlgo_Fanatic
07 May 2013, 14:14
Retrieve the position details in the OnPositionOpened event.
protected override void OnStart() { // open first trade TradeType sell = TradeType.Sell; var request = new MarketOrderRequest(sell, 10000) { Label = "Robot 1", SlippagePips = 0, StopLossPips = 10, TakeProfitPips = 20 }; Trade.Send(request); } protected override void OnPositionOpened(Position openedPosition) { // retrieve position details // open new trade if trades are less than 5// (you can have a global counter that increaments here or add the positions in a List.
// see example with List) }
@cAlgo_Fanatic