![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
The future... well, well. "Thank you, it's funny" (c).
When optimizing, I would like to see the result of the run as a percentage, rather than the numbers displayed in the "Result" column. And in the backtest, it would be nice if the result "Net profit" had a profit in %.
Insert your formula into the OnTester() event handler and see the result you need.
I suggest to make the global variables of the program not to cross the variables and parameters in plugins in MQL4 and MQL5. I declared a variable 'point' in my Expert Advisor and now I'm getting a lot of messages like: "declaration of 'point' hides global declaration in file 'expert.mq4' at line 153 ChartObject.mqh 154 39". It's horrible when you can't declare a variable in a module, program, which is in the parameters of another module. Why does ChartObject.mqh module need to see my Expert Advisor, expert.mq4, if ChartObject.mqh doesn't declare it explicitly?
Obviously it will help you.
Yes, I have this line in my Expert Advisor, but it is not in ChartObject.mqh module. I'm not going to rewrite all standard modules because of it...
Got it. In that case, don't create global variables. You may do without them. Otherwise, with any coincidence, e.g. a very common name:
int i;
globally declared will be overwritten by locally declared. This is what you are warned about.
And plugin does not have its own scope, it's not a module, it's just a piece of code that will be inserted where you write include.
Got it. Then don't create global variables. You can do without them.
What do you mean, don't create them? In any programming language global variables are freely used and it's ok, but the compiler swears. The error is not crucial, but still it is inconvenient.
double point = MarketInfo(EA_Symbol(), MODE_POINT);
The variable point reports the price of 1 point and is a substitute for the standard Point. The MarketInfo(EA_Symbol(), MODE_POINT) function gives the price of 1 point for any symbol. Further, the variable point can be used in any function, in the body of the EA, if it is a global variable of course. Agree that such cases cause some inconveniences quite often (if you certainly have experience in MQL programming). And although they can be avoided, but the question is why, if in other modern languages such problems simply do not exist?