Zero Divide error

 

Hi guys, when I test the first part of the code I sometimes get zero divide errors. I'm aware this happens when a candlestick doesn't have any wicks. Looked online but couldn't find a clear solution.

double CalculateUpperWick()
   {
      if(BullishCandlestick() == true)
      {   
         UpperWick = (iHigh(symbol[0], timeFrame[0], 1) - iClose(pair[0], timeFrame[0], 1))/ GetPipValue();
       } 
      else if(BullishCandlestick() == false)
      {
         UpperWick = (iHigh(symbol[0], timeFrame[0], 1) - iOpen(pair[0], timeFrame[0], 1))/ GetPipValue();
      }
     
      return UpperWick;
   }

I've attempted to create this function which would always return a value of a wick greater than 0 however I doubt this is correct or can be done. Would appreciate any help you could provide!

Thanks for the help & Merry Christmas!

   double DojiWickRatio()
   {
      if(UpperWick == 0)
      {
         UpperWick = 0.000001;
      }
      else
      {
         UpperWick = UpperWick;
      }
      
      return UpperWick;
   }
 
Look for the error in the 'GetPipValue' function
 
Vladimir Karputov #:
Look for the error in the 'GetPipValue' function

 There is none


 double GetPipValue()
   {
      if(_Digits >= 4)
      {
         return 0.0001;
      }
      else
      {
         return 0.01;
      }
   }
 
You can fake repair the code:

If it does not solve the issue, you will need to debug your code.

... / (GetPipValue() + DBL_MIN);
 
Dominik Egert #:
You can fake repair the code:

If it does not solve the issue, you will need to debug your code.

Works perfectly. Thanks so much! 
Reason: