Hey folks.
I must have made a very stupid mistake, but I can not figure it out on my own.
I did make myself a function to find the Highest/Lowest Buy/Sell Orders.
Everything works fine, but the value for the "LowestBuy". LowestBuy always returns same value as HighestBuy. WHY?
This is driving me nuts!
I must have made a very stupid mistake, but I can not figure it out on my own.
I did make myself a function to find the Highest/Lowest Buy/Sell Orders.
Everything works fine, but the value for the "LowestBuy". LowestBuy always returns same value as HighestBuy. WHY?
This is driving me nuts!
Inserted Code
//Global variables needed:
/*
double HighestBuy = 0;
double LowestBuy = 0;
double HighestSell = 0;
double LowestSell = 0;
*/
void GetOpenOrderPriceForMostRecent ()
{
HighestBuy = 0;
LowestBuy = 0;
HighestSell = 0;
LowestSell = 0;
int TotalOrders;
TotalOrders = OrdersTotal();
for(int iii=TotalOrders-1;iii>=0;iii--)
{
OrderSelect(iii, SELECT_BY_POS);
if(OrderSymbol() != Symbol()) continue;
if(OrderType() == OP_BUY && OrderOpenPrice() > HighestBuy)
{
HighestBuy = OrderOpenPrice();
}
if(OrderType() == OP_BUY && OrderOpenPrice() < LowestBuy || OrderType() == OP_BUY && LowestBuy == 0)
{
LowestBuy = OrderOpenPrice();
}
if (OrderType() == OP_SELL && OrderOpenPrice() > HighestSell)
{
HighestSell = OrderOpenPrice();
}
if (OrderType() == OP_SELL && OrderOpenPrice() < LowestSell || OrderType() == OP_SELL && LowestSell == 0)
{
LowestSell = OrderOpenPrice();
}
}
}