Download MetaTrader 5

'}' - semicolon expected

To add comments, please log in or register
ailanshi_7 2016.04.25 21:14 

I was practicing to make a simple E.A.but the following errors occurs .

"        '}' - semicolon expected                             "

"        'else' - illegal 'else' without matching 'if'       " 

Can anyone please point out my mistake in the following program  and make the correction.

#property copyright "Copyright 2016, MetaQuotes Software Corp."
#property link      ""
#property version   "1.00"
#property strict

extern int period = 14;

void OnTick()
   bool bill;
   bill = rsi();
    if (bill == true)
    else if(bill == false)
   Alert("there is something wrong");

bool rsi()
double point;

point =  iRSI(Symbol(),0,period,PRICE_TYPICAL,0);
else if(point<30)
Fernando Carreiro
Fernando Carreiro 2016.04.25 21:45  
  • Please use the "SRC" button to submit code samples!
  • You are missing ";" terminators on the OrderSend lines.
  • You are missing the slippage parameter on your 2nd OrderSend.
  • Don't use "if (bill == true)". Just use "if(bill)" or "if(!bill)" because it is already a Boolean.
  • Boolean values only have two states, true or false. There is no third state as is implemented in your code "if(bill == true) ... else if(bill == false) ... else ..."
  • Always check the results of the "OrderSend" and other such functions.
  • There is no predefined "Null". It is case sensitive, so use "NULL".
  • There are several other mistakes, but start with these.

To add comments, please log in or register