Else-if Limit?

 

Is there a limit for the number of else if statements?

I am attempting to define a couple of vars depending on what currency the EA is placed on. I'm running into a mismatched { error and the position referred to is sporadic depending on where I place a function - it's not always in the same place. I just want to eliminate the possibility that I'm overloading the number of else-ifs the system can handle without getting confused.

if (Symbol()=="EURUSD")

{

var1 = 1;

var2=2;

}

else if (Symbol()=="USDJPY")

{

var1 = 2;

var2=3;

}

else if ......

 

"Is there a limit for the number of else if statements?"

There is no limit

.

The code you show has no mismatched {} or () or ""

The code as it stands, with addition of int var1,var2; and //else if ......

and then surrounded with int start() {...your code... return(0);}

.

compiles cleanly.

.

the errors therefore are within the code you are not showing.

 
ukt wrote >>

"Is there a limit for the number of else if statements?"

There is no limit

.

The code you show has no mismatched {} or () or ""

The code as it stands, with addition of int var1,var2; and //else if ......

and then surrounded with int start() {...your code... return(0);}

.

compiles cleanly.

.

the errors therefore are within the code you are not showing.

The vars are defined by extern double at the header - if they are, they are filled in by the function.

That brings a question up.

Can't the functions like this be set after the closing brackets of start() like:

int start()

{ code }

Void MyFunction()

{ code}

Spaces/tabs are ignored, correct?

I use return; not return(0) since I used a void. Correct, right?

I went through the brackets and they all sem to match. Dont want anyone here to debug code, just trying to eliminate things that I may not know about.....been there and done that...:-)

 

Can't the functions like this be set after the closing brackets of start()

yes

Spaces/tabs are ignored, correct?

yes, white space

I use return; not return(0) since I used a void. Correct, right?

yes. return not even required, see doc for return.

went through the brackets and they all sem to match

check for { matched visually with )

Or paste your code into a C editor with more features for fancy formatting and syntax checking. I use JEdit

 

Thanks for the help.

My own stupid fault. If you use a function, make sure to have a right closing parenthesis when passing parameters...duh...

 

gnovak, Phew... glad you have solution. Mismatched anything can be a real nightmare :)

phy,

1. is Jedit used as main util? Or generally use ME. Am thinking about context sensitive popups and <esc>,F1 usage.

2. Like with Wine, how get [at least] ME to see it's help files...

3. Do you think ME.future will open up to allow other ed's ?

 

JEdit just an occasional tool. No integration with MT4. Make unindented code indented, for instance. Help match braces, another.

Ninjatrader uses some sort of run-time of VisualStudio C# as its editor, could possibly be on MQL5 agenda. Learn Russian, give Stringo a call.

 

"Make unindented code indented"

this is interesting, yes... I see is plugin for gaining beauty to 'others' beastly code

"Learn...a call"

NEVER

 
ukt wrote >>

"Make unindented code indented"

this is interesting, yes... I see is plugin for gaining beauty to 'others' beastly code

"Learn...a call"

NEVER

Not to turn this into one of those long editor threads, but....I've been using UltraEdit. love it. Tons of flexibilty. great support. C++/C and other templates, match braces, macros, indents, caps, tons of stuff....

 

Hmmm

UltraEdit & JEdit - thanks for the tips chaps

-BB-

Reason: