Error creating function

 

I am try to create a function which can calculate UpperWick of any candlestick depending on whether it is bullish or bearish. The LongPosition() boolean works fine but the CalculateUpperWick() function has many errors which I can't seem to solve. Also don't know how to properly define the UpperWick and CalculateUpperWick() functions.


I'd much appropriate anyone who could help me

double UpperWick = CalculateUpperWick();



 bool LongPosition() 

  {

      if(iOpen("EURCHF", PERIOD_H1, 1) > iClose("EURCHF", PERIOD_H1, 1))

      {

         return true;

      }    

      else

      {

         return false;

      }

   }

 

 double CalculateUpperWick(bool LongPosition, double iHigh(), double iClose())

   {

      double UpperWick();

      if(LongPosition()== true)

      {

         UpperWick() = (iHigh()- iClose());

      }  

        

      else

      {

         UpperWick() = (iHigh()- iOpen());

      }

      

      return UpperWick;

   }



Here are the following four errors:


Screenshot 2021-10-26 at 13.58.51.png

 
  1. Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
              General rules and best pratices of the Forum. - General - MQL5 programming forum (2019)
              Messages Editor

  2.  double CalculateUpperWick(bool LongPosition, double iHigh(), double iClose())

    You can pass a variable or an array into functions. You can not pass a function.

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

Reason: