Your post |
Code |
---|---|
Code Line #1 GoTo ResumeHere Code Line #2 Code Line #3 Code Line #4 Code Line #5 GoTo ResumeHere: Code Line #6 |
Code Line #1 if(!performLines2_5){ Code Line #2 Code Line #3 Code Line #4 Code Line #5 } Code Line #6 |
MT5: Begin learning to code it. If you don't learn MQL4/5, there is no common language for us to communicate. If we tell you what you need, you can't code it. If we give you the code, you don't know how to integrate it into yours.
So how would I do this?
I have a series of If statements (about 20 IFs)
If (Num #1)
{
Do Num #1
Go to End of Routine \\ Don't perform any other Ifs on the current tick
}
If (Num #2}
{
Do Num #2
Go to End of Routine \\ Don't perform any other Ifs on the current tick
}
If (Num #3}
{
Do Num #3
Go to End of Routine \\ Don't perform any other Ifs on the current tick
}
Thanks William
Ross
Hi All,
How do I transfer program control, in MQL4, to a specific line?
As stated, there are no GOTO statements in MQL. You need to find another way.
I just use a while statement, for multiple if statements all needed to be true;. But you could use Switch or branch off to another function, or return; Depends how your EA works.
bool ok=false; while(true){ if(!cond1)break; if(!cond2)break; ok=true; break; }
So how would I do this?
I have a series of If statements (about 20 IFs)
If (Num #1)
{
Do Num #1
Go to End of Routine \\ Don't perform any other Ifs on the current tick
}
If (Num #2}
{
Do Num #2
Go to End of Routine \\ Don't perform any other Ifs on the current tick
}
If (Num #3}
{
Do Num #3
Go to End of Routine \\ Don't perform any other Ifs on the current tick
}
if (cond_1) { // task #1 } else if (cond_2} { // task #2 } else if (cond_3} { // task #3 } else ...
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi All,
How do I transfer program control, in MQL4, to a specific line?
For Example, using VBA you could go after, Line #1 to Line #6 (Skipping line #2-#5).
Code Line #1
GoTo ResumeHere
Code Line #2
Code Line #3
Code Line #4
Code Line #5
GoTo ResumeHere:
Code Line #6
Many Thanks
Ross Crill