How to modify the % of the code

 

This code is about showing the % of the the body

int candleclose()
{
   double open    = iOpen(_Symbol,PERIOD_CURRENT,1);
   double high    = iHigh(_Symbol,PERIOD_CURRENT,1);
   double low     = iLow(_Symbol,PERIOD_CURRENT,1);
   double close   = iClose(_Symbol,PERIOD_CURRENT,1);

   int range = int ((high-low)/_Point);
   int closerange = 0;
   
   if(open<close) closerange = int ((close-low)/_Point); // Bullish
   else if(open>close) closerange = int ((high-close)/_Point); // Bearish
   
   return (closerange*100)/range;
}

how to modify the code as shown below:

If it is bearish Bar = it will calculate the % of the "high to the close" of the Bar

Bearish Bar

If it is bullish Bar = it will calculate the % from the "low to the close" of the Bar
Bullish Bar
Thank for your help ;)




 
Tea-TIme: how to modify the code as shown below: ... Thank for your help ;)
Help you with what? You already have the code.