Can any body help me with this - page 2

 
Please explain what this function DTNAR is supposed to do, and what the outer For loop is supposed to do. What does DTNAiPtFc name mean, why do you test for DTNAiPtFc>0 if it is set to 100, this makes no sense.
 
lippmaje:
Please explain what this function DTNAR is supposed to do, and what the outer For loop is supposed to do. What does DTNAiPtFc name mean, why do you test for DTNAiPtFc>0 if it is set to 100, this makes no sense.

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
double buyprice,sellprice,pointDTNA,AskV,BidV,pacal;
buyprice=MarketInfo(Symbol(),MODE_ASK);
sellprice=MarketInfo(Symbol(),MODE_BID);
if(DTNAiPtFc>0)
   {
     
      int y=0;
      int z;
      pointDTNA=MarketInfo(Symbol(),MODE_POINT);
      for (z=y;z<=DTNAiPtFc;z++)
         {
         pacal=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+pacal;// current ask + 0.00002
         BidV=sellprice-pacal;//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 if not then false
                     return(true);
                                         
                  }
            }
         }
   }
   else return(false);
   
}
//I dont know whether it will wore 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
 
I have answered this in the other thread. Please do not start two topics for the same thing it is confusing.