MQ4 Error i need help

 
i keep getting error what am i doing wrong


   
input int    ATR_Period    = 22;
input double ATR_Multiplier = 3.0;
input bool   ShowLabels    = true;
input bool   UseClose      = true;
input bool   Highlight     = true;

int direction;

double longStop, longStopPrev, shortStop, shortStopPrev, atr;

void OnInit()
{
  direction = 0;
}
void OnTick()
    {
    atr = ATR_Multiplier * iATR(NULL, 0, ATR_Period);
    if (UseClose)
  {
    longStop = iHighest(NULL, 0, MODE_CLOSE, ATR_Period) - atr;
    shortStop = iLowest(NULL, 0, MODE_CLOSE, ATR_Period) + atr;
  }
  else
  {
    longStop = iHighest(NULL, 0, MODE_HIGH, ATR_Period) - atr;
    shortStop = iLowest(NULL, 0, MODE_LOW, ATR_Period) + atr;
  }

  longStopPrev = longStop;
  shortStopPrev = shortStop;

  if (Close[0] > longStopPrev)
    longStop = MathMax(longStop, longStopPrev);

  if (Close[0] < shortStopPrev)
    shortStop = MathMin(shortStop, shortStopPrev);
    
    if (Close[0] > longStopPrev)
    longStop = MathMax(longStop, longStopPrev);
    
    if (Close[0] < shortStopPrev)
    shortStop = MathMin(shortStop, shortStopPrev);
    
     direction = (Close[0] > shortStopPrev ? 1 : (Close[0] < longStopPrev ? -1 : direction));
     
     if (Highlight)
  {
    if (direction == 1)
      ObjectCreate("LongStop", OBJ_TREND, 0, Time[0], longStop, Time[0] + Period() * 2, longStop);
    else if (direction == -1)
      ObjectCreate("ShortStop", OBJ_TREND, 0, Time[0], shortStop, Time[0] + Period() * 2, shortStop);
    else
    {
      ObjectDelete("LongStop");
      ObjectDelete("ShortStop");
    }
  }

  if (ShowLabels)
  {
    if (direction == 1)
      ObjectCreate("LongLabel", OBJ_LABEL, 0, Time[0], longStop, "Long");
    else if (direction == -1)
      ObjectCreate("ShortLabel", OBJ_LABEL, 0, Time[0], shortStop, "Short");
    else
    {
      ObjectDelete("LongLabel");
      ObjectDelete("ShortLabel");
    }
 
  if (direction != direction[1])
    Alert("Chandelier Exit direction has changed!");

  if (direction == 1 && direction[1] == -1)
    Alert("Chandelier Exit buy signal!");

  if (direction == -1 && direction[1] == 1)
    Alert("Chandelier Exit sell signal!");
    }
     
     
     
    }

How to Become a Signals Provider for MetaTrader 4 and MetaTrader 5
How to Become a Signals Provider for MetaTrader 4 and MetaTrader 5
  • www.mql5.com
Do you want to offer your trading signals and make profit? Register on MQL5.com website as a Seller and specify your trading account to offer your signals to traders.
 
chukwudi igbojionu:
i keep getting error what am i doing wrong

do you expect people to just guess what your problem is?  how about you provide some details or do you expect everyone to download your code, compile and run it!

 
  1.     longStop = iHighest(NULL, 0, MODE_CLOSE, ATR_Period) - atr;

    Incorrect number of parameters. Read the documentation.

  2. iHighest does not return a price. Read the documentation.

  3.   longStopPrev = longStop;
      shortStopPrev = shortStop;
    
      if (Close[0] > longStopPrev)
        longStop = MathMax(longStop, longStopPrev);
    What is the purpose of xPrev when they are always the same?