I am trying to create a function that will not allow an order to be placed if there already is an order at any given point.
I created the function below and me EA is still placing orders ontop of eachother, can someone give any advice?
Thanks
//-------------
Part that calls the function in the program
//-------------
Function:
I created the function below and me EA is still placing orders ontop of eachother, can someone give any advice?
Thanks
//-------------
Part that calls the function in the program
Inserted Code
buytradeok = buytradeokfunc(highline);
Inserted Code
if (buytradeok < 1) {BUYORDER(LotValue,highline,MaxSlippage,lowline,takeprofithigh);} Function:
Inserted Code
int buytradeokfunc(double HIGHLINE)
{
for(int i=0;i<OrdersTotal();i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break;
if(OrderSymbol()==Symbol())
{
if(OrderType()==OP_BUY)
{
if (CompareDoubles(OrderOpenPrice(),HIGHLINE)) return(1);
else return(0);
}
}
}
}