anuj71:
if (TradingAccountType == "Demo") { UserTradeAccount = "Active"; } else { if (TradingAccountNumber == "" && TradingAccountName == "") { UserTradeAccount = "Active"; } else { if (TradingAccountNumber == TradingAccountNumberAuto || TradingAccountName == TradingAccountNameAuto) { UserTradeAccount = "Active"; } } }
if (TradingAccountType == "Demo") { UserTradeAccount = "Active"; } else { if (TradingAccountNumber == "" && TradingAccountName == "") { UserTradeAccount = "Active"; } else { if (TradingAccountNumber == TradingAccountNumberAuto || TradingAccountName == TradingAccountNameAuto) { UserTradeAccount = "Active"; } } }
if (TradingAccountType == "Demo" || (TradingAccountNumber == "" && TradingAccountName == "") || (TradingAccountNumber == TradingAccountNumberAuto || TradingAccountName == TradingAccountNameAuto)) { UserTradeAccount = "Active"; }
this is what i recommend
anuj71: What is correct way to add if else statement.
if (condition1){ doCondition1;} else if(condition2){ doCondition2;} ⋮ else { doConditionN[];}
Arpit T #:
this is what i recommend
this is what i recommend
Thanks for making it more simplified and reliable my existing if else logic. But my question is still same, how to write if else sequence in MQL4
If else sequence separately :
if (condition1) { //Condition 1 task } else { if (condition2) { //condition2 task } else { if(condition3) { //condition3 task } else { //condition else task}
Else if statement sequence :
if (condition1) { //Condition 1 task } else if (condition2) { //condition2 task } else if(condition3) { //condition3 task } else { //condition else task}

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello,
What is correct way to add if else statement.
Type 1 :
Type 2 :