Can I see the code, if you don't mind? I've tried it all ways, but it doesn't work.
I don't know whether it's easier to add the risk in percents of securities. I would like to use the code as an example and show the profitability of my trading robot.
Each casevariant can be marked with an integer constant, a character constant or a constant expression. A constant expression may not include variables or function calls. Aswitch statement must be of integer type.
Valmars: Each casevariant can be marked with an integer constant, a character constant or a constant expression. A constant expression may not include variables or function calls. A switch statement must be of integer type.
Interesting: What do you think this function should return? The way I see it -
It doesn't work like this.
if (LotStep == 0.01)return(NormalizeDouble(Lot,2));
if (LotStep == 0.1) return(NormalizeDouble(Lot,1));
if (LotStep == 1.0) return(NormalizeDouble(Lot,0));
This is how it works.
if (LotStep == 0.01)Lot=NormalizeDouble(Lot,2);
if (LotStep == 0.1) Lot=NormalizeDouble(Lot,1);
if (LotStep == 1.0) Lot=NormalizeDouble(Lot,0);
return(Lot);
Right and it doesn't work. It's up to everyone, but I personally have always believed that return() should be declared at the end of any function, and the compiler supports me in this.
PS
Personally, back in MQL4 I started using Result variable to calculate the return value. I should note that calling return() at the end of function code is mandatory and its presence in the beginning/middle of code will sometimes be perceived as some analogue of break (the only difference is that break itself isn't perceived by the compiler as a command to return the value of function's result).
Can I see the code, if you don't mind? I've tried it all ways, but it doesn't work.
I don't know whether it's easier to add the risk in percents of securities. I would like to use the code as an example and show the profitability of my trading robot.
Each case variant can be marked with an integer constant, a character constant or a constant expression. A constant expression may not include variables or function calls. A switch statement must be of integer type.
I gave you code that works without errors
I'm wondering why a construction like this doesn't work, it gives an error - '}' - not all control paths return a value
I gave you the code that works without errors.
I'm wondering why a construction like this doesn't work, it gives an error - '}' - not all control paths return a value
return(Lot);What do you think this function should return? The way I see it -
It doesn't work like this.
This is how it works.
It doesn't work like this
Right and it doesn't work. It's up to everyone, but I personally have always believed that return() should be declared at the end of any function, and the compiler supports me in this.
PS
Personally, back in MQL4 I started using Result variable to calculate the return value. I should note that calling return() at the end of function code is mandatory and its presence in the beginning/middle of code will sometimes be perceived as some analogue of break (the only difference is that break itself isn't perceived by the compiler as a command to return the value of function's result).
It is not correct to use the == condition for variables of type double. It is recommended to compare like this: