Basically, I would like to know the Open Price of the Second order in a series of buys or sells.
The reason being, that in a series of buys, the Ask price should be higher than the Open price of the previous order, starting from the second order.
Example:
All Existing Orders are Closed;
Order#1 1.2100
Order#2 1.2005
then for the next order, the Ask has to be greater than the Open price of Order#2 and so on .
Reverse For shorts.
double GetLastPrice(int ticket)// where ticket = ticket of last order
{
if(OrdersTotal() >= 2)
{
for(int order = 2; order < OrdersTotal(); order++)
{
if(OrderSelect(order, SELECT_BY_TICKET, MODE_TRADES))
{
if(OrderTicket() == ticket)
{
return( OrderOpenPrice());
}
}
}
}
return(EMPTY_VALUE);
}
The reason being, that in a series of buys, the Ask price should be higher than the Open price of the previous order, starting from the second order.
Example:
All Existing Orders are Closed;
Order#1 1.2100
Order#2 1.2005
then for the next order, the Ask has to be greater than the Open price of Order#2 and so on .
Reverse For shorts.
double GetLastPrice(int ticket)// where ticket = ticket of last order
{
if(OrdersTotal() >= 2)
{
for(int order = 2; order < OrdersTotal(); order++)
{
if(OrderSelect(order, SELECT_BY_TICKET, MODE_TRADES))
{
if(OrderTicket() == ticket)
{
return( OrderOpenPrice());
}
}
}
}
return(EMPTY_VALUE);
}