If you have too many 'if'-s on a single variable the switch operator might be better:
https://www.mql5.com/en/docs/basis/operators
These are the main functions in indicators and experts:
https://www.mql5.com/en/docs/basis/function/events
And this is the most precious link of all the MQL5 documentation:
https://www.mql5.com/en/docs/function_indices
You will need it later.
Function a() may depend on number of open positions, symbols and so called 'magic number' (whether the deals were made by this expert or something else), if 'yes' - skip the check for opening conditions.
- www.mql5.com
If you have too many 'if'-s on a single variable the switch operator might be better:
https://www.mql5.com/en/docs/basis/operators
These are the main functions in indicators and experts:
https://www.mql5.com/en/docs/basis/function/events
And this is the most precious link of all the MQL5 documentation:
https://www.mql5.com/en/docs/function_indices
You will need it later.
Function a() may depend on number of open positions, symbols and so called 'magic number' (whether the deals were made by this expert or something else), if 'yes' - skip the check for opening conditions.
There are several ways to do this, you can use flags, to do that.
int condition = 0; // global variable int start () { if ( condition==0) // here its a flag { function_a(condition); // when condition 1 becomes=1, this flag will close } return (0); } void function_a (int &condition2) // here is the function, you pass the condition value by reference { if (Buy happens) condition2=1; }
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
I am new in programming :-) I want to write a program like below I want to know how can I swap between functions
function a()
{
if ( ------ )
buy;
else if ( ------- )
sell;
}
if any of the condition happend and it sell or buy, go to function b () and
the fanction a() condition does'nt check again.
I want to know how to swap between functions and how can I stop a function if any of the conditions inside was true.
thanksss