# Boolean Error

The code compiles correctly yet a warning occurs which says "expression not boolean". In my script, if I were to Alert(UpperWick), the answer is always 1.0 rather than it calculating the upper wick in function of whether the candlestick is bullish or bearish. Much appreciate your help!

``` double UpperWick = CalculateUpperWick();

bool BullishCandlestick()
{
if(iOpen("EURUSD", PERIOD_H1, 1) < iClose("EURUSD", PERIOD_H1, 1))
{
return true;
}
else
{
return false;
}
}

bool CalculateUpperWick()
{
if(BullishCandlestick() == true)
{
UpperWick = iHigh("EURUSD", PERIOD_H1, 1) - iClose("EURUSD", PERIOD_H1, 1);
}
else
{
UpperWick = iHigh("EURUSD", PERIOD_H1, 1) - iOpen("EURUSD", PERIOD_H1, 1);
}
return UpperWick;
}

```

1. ```     bool CalculateUpperWick()
```

CalculateUpperWick returns a bool. Since UpperWick is (almost) never zero, it returns true, which is up cast to a double and stored.

2.  Your code ```      if(iOpen("EURUSD", PERIOD_H1, 1) < iClose("EURUSD", PERIOD_H1, 1))       {          return true;       }           else       {          return false;       }``` Simplified `      return iOpen("EURUSD", PERIOD_H1, 1) < iClose("EURUSD", PERIOD_H1, 1);`          Increase Order after stoploss - MQL4 programming forum #1.3 (2017)

I've looked at it for a while but I don't quite understand what you mean. Can you please show me how to create CalculateUpperWick() . Much appreciate the help :)

luxecapital #:
I've looked at it for a while but I don't quite understand what you mean. Can you please show me how to create CalculateUpperWick() . Much appreciate the help :)
Just change the return type of the function to double instead of bool:

`double CalculateUpperWick()`

DECOPMILATION FORBIDDEN!

Reason: