You can convert a number to a string and write a function to process the characters in that string. It's not complicated here - we only round a number if it has more than one digit after the decimal point.
OK, I'll really try it. Thank you very much for the idea!
there is a function "double MathRound( double value)", but I need the rounding to a larger decimal fraction, and if the number is integer or already decimal, then leave it alone.
For example: 1) 0.744 round to 0.8; 1.233 round to 1.3
the correct way to write it: if (OrderSelect (OrdersHistoryTotal()-1, SELECT_BY_POS, MODE_HISTORY) == OrderTakeProfit() == OrderClosePrice()) Stop=false // i.e. if the last order from the end closed at Take Profit (taking profit upon reaching a certain level), the Stop=false? (Stop in global variables)
this question has arisen because the order opens by a condition if((iClose(NULL,0,1)<ma) && Stop==True)...
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
You can convert a number to a string and write a function to process the characters in that string. It's not complicated here - we only round a number if it has more than one digit after the decimal point.
there is a function "double MathRound( double value)", but I need the rounding to a larger decimal fraction, and if the number is integer or already decimal, then leave it alone.
For example: 1) 0.744 round to 0.8; 1.233 round to 1.3
2) 0.9 or 3 or 1.5 do not touch.
Didn't check it, but somehow.
Completely useless gesture enough double res=NormalizeDouble(res,1) mathematically still handle double res = 3; or double res = 3.0;
The difference will only be visible in printout (graph), but this is not in the author's description of the problem.
Completely useless gesture enough double res=NormalizeDouble(res,1) mathematically still handle double res = 3; or double res = 3.0;
The difference will only be visible in the printout (graph), but this is not in the author's description of the problem.
Well, you can do it this way:
I think the first variant is better. It will work faster.Well, you could go like this:
I think the first option is best. It will work faster.This option.
should be the fastest
Vadim's version is 20-25% faster, but the effect starts to show up steadily when the number of iterations exceeds a million. (checked)
Show me the code, how did you check it
Vadim's version is 20-25% faster, but the effect starts to show up steadily when the number of iterations exceeds a million. (tested)
the correct way to write it: if (OrderSelect (OrdersHistoryTotal()-1, SELECT_BY_POS, MODE_HISTORY) == OrderTakeProfit() == OrderClosePrice()) Stop=false // i.e. if the last order from the end closed at Take Profit (taking profit upon reaching a certain level), the Stop=false? (Stop in global variables)
this question has arisen because the order opens by a condition if((iClose(NULL,0,1)<ma) && Stop==True)...