GetOrders
Hi,
When I tried to use the GetOrders function, it never assigns orders to the array. I know this because the array length was zero. Even when I see active orders in orders panel.
Thanks
Replies
Hello, chrisbiz1e!
Unfortunately, we didn't find the problem.
We created the script (that includes GetOrders function), and tested it on Algostudio & Trading System List :
Code of the script :
Order[] orders;
public override void Init()
{
openOrder();
if (GetLastError()==0)
{
orders = Orders.GetOrders(true);
Print("Array lenght: "+orders.Length);
}
else
{
Print("Error: "+GetLastError());
}
}
void openOrder()
{
NewOrderRequest request = new NewOrderRequest();
request.Amount = 0.01;
request.Instrument = Instruments.Current;
request.Account = Accounts.Current;
request.Type = OrdersType.Limit;
request.Price = Instruments.Current.LastQuote.Ask - 0.001;
request.Side = Operation.Buy;
request.StopLossOffset = 0.0001;
request.TakeProfitOffset = 0.0001;
Orders.Send(request);
}
Testing results for Algostudio :
Testing results for Trading System List :
Please, give us more information with an example of your case, to help you.
Regards, PTMC Support.
Join PTMC community to post your replies on forum