bool DTNAR() // this function name i gave randomly to try whether i could check that with in certain pip above and below the current price , is any order opened or not.
{
double DTNAiPtFc=100; // currently i gave this constant value, but later another function will return this value according to symbol,its in the pipae ( in case of 5 digit broker)
double buyprice,sellprice,pointDTNA,AskV,BidV,pacal;
buyprice=MarketInfo(Symbol(),MODE_ASK);
sellprice=MarketInfo(Symbol(),MODE_BID);
if(DTNAiPtFc>0) //i will be getting the value from another function so i added this condition to check whether the pipae id more than 0 or not
{
pointDTNA=MarketInfo(Symbol(),MODE_POINT);
for (int z=0;z<=DTNAiPtFc;z++)
{
pical=pointDTNA*z;//when z= 2, the variable equals to Point of symbol * 2, if symbol with mini tick 0.00001, we get 0.00002
AskV=buyprice+pical;// current ask + 0.00002
BidV=sellprice-pical;//current bid - 0.00002
if(AskV>0&&BidV>0)
{
for(int TrC=OrdersTotal()-1;TrC>=0;TrC--)
{
if(!OrderSelect(TrC,SELECT_BY_POS))continue;
if(OrderSymbol()!=Symbol())continue;
if(OrderType()!=OP_BUY||OrderType()!=OP_SELL)continue;
if(OrderOpenPrice()==AskV||OrderOpenPrice()==BidV) // check whether any opened order with price equal to AskV or BidV if yes returns true to whole function
return(true);
}
}
}
}
else return(false);
}
//I dont know whether it will work effeciently or not
//but i didnt get any other clue to code to check is any order opened within certain pips or not
//Previously i used limitation in opened order for same direction
//for this case i was unable to imagine how to do, and end up with this