Questions from Beginners MQL5 MT5 MetaTrader 5 - page 926
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
What operator can be used from which 2 results can be returned? I use the if statement to find this condition, but it cannot return multiple results in which case I have to write the same condition 2 times, which is why I am writing with this question.
It's not quite clear what conditions are checked, but maybe switch will work for you. And at TRUE assign the values you need.
Is there a function for swapping values of two variables ?
Forum on trading, automated trading systems and trading strategies testing
Features of mql5 language, subtleties and tricks
fxsaber, 2018.08.26 19:02
The English part of the forum showedThank you. I'll have to get to grips with these definitions.
Hello! Why does the Bars() function have different values when called from the indicator and the Expert Advisor and HOW TO MAKE THE MATCH?
Show code from EA and indicator.
Show code from EA and indicator.
Just call the function Bars(_Symbol,_Period)
Just call the function Bars(_Symbol,_Period)
Do I have to ask for a printout of the result separately?
I don't get a difference. Although in the tester this variant is not excluded due to availability of history about which I know little, only vague recollections of what I read some time ago. After all, it turns out the total number of available bars. But if you ask from time to time, there can't be any difference.
The if statement does not return any value.
There are two options for assigning values to certain variables in a separate function:
1. Variables must be visible in all parts of the program. That is, they must be declared at the global variable level (at the beginning of the code).
2. To pass variables declared locally to the user function by reference. That is, put & before the variable name
It means that if a condition is true, two identical actions must be performed, e.g.
Variables I have declared and nothing is done except this actionPrice_UrNij = Bar_Cl[iHgCL]>Bar_Op[iHgOP] ? Bar_Cl[iHgCL]:Bar_Op[iHgOP]; or this actionPrice_UrVerh = Bar_Cl[iLwCL]<Bar_Op[iLwOP] ? Bar_Cl[iLwCL]:Bar_Op[iLwOP]; how to make it perform 2 identical actions with both top and bottom levels by condition. Can someone tell me how to write it shorter?
It's not quite clear what conditions are checked, but maybe switch will work for you. And at TRUE assign the values you want.
You need to executePrice_UrNij = Bar_Cl[iHgCL]>Bar_Op[iHgOP] ? Bar_Cl[iHgCL]:Bar_Op[iHgOP]; andPrice_UrVerh = Bar_Cl[iLwCL]<Bar_Op[iLwOP] ? Bar_Cl[iLwCL]:Bar_Op[iLwOP];.