//+------------------------------------------+
//| zShowLastArrow mq4                       |
//| script to test arrow values              |
//+------------------------------------------+
#property copyright "z"
#property link      ""
string sUpTime;
string sDnTime;
string sValue0="x";
string sValue1="x";
string sLow="x";
string sHigh="x";
double dValue0=0;
double dValue1=0;
double dHigh=0;
double dLow=0;
int iLoop=0;
int iLoopMax=100;
int shift=0;
//+------------------------------------------------------------------+
int start()
{
   //// find most recesnt blue arrow
   iLoop=0;
   shift=0;
   while(true)
   {
      iLoop++;
      if(iLoop>iLoopMax) break;
      dValue0 = iCustom(NULL,0,"BrainTrend2SigALERT5",500,0,0,0,shift);  //0=Blue
      sValue0 = DoubleToStr(dValue0,6);
      //Print("loop: ", iLoop, ", val0: ", sValue0);
      if( (dValue0 == 0) || (dValue0 == EMPTY_VALUE) )
      {
         //not a valid value
      }
      else
      {
         sUpTime = TimeToStr(Time[shift]);
         sValue0 = DoubleToStr(dValue0,6);
         sLow = DoubleToStr(Low[shift],6);
         Print("Last blue arrow time: ", sUpTime, ", placed at: ", sValue0, ", low of bar: ", sLow);
         break;
      }
      shift++;
   }
   ///////////////////////////////////////////////////////   
   //// find most recesnt red arrow
   iLoop=0;
   shift=0;
   while(true)
   {
      iLoop++;
      if(iLoop>iLoopMax) break;
      dValue1 = iCustom(NULL,0,"BrainTrend2SigALERT5",500,0,0,1,shift);  //1=Red
      sValue1 = DoubleToStr(dValue1,6);
      if( (dValue1 == 0) || (dValue1 == EMPTY_VALUE) )
      {
         //not a valid value
      }
      else
      {
         sDnTime = TimeToStr(Time[shift]);
         sValue1 = DoubleToStr(dValue1,6);
         sHigh = DoubleToStr(High[shift],6);
         Print("Last red arrow time: ", sDnTime, ", placed at: ", sValue1, ", high of bar: ", sHigh);
         break;
      }
      shift++;
   }   
   return(0);
}
//+------------------------------------------------------------------+

