When testing a multi-currency EA, there is a problem with the lot size. I have a fixed 0.03, but during the test the orders appear with the volume of 0.1. Immediately a failure appears on the chart. Is it just me?
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.
How do I get the opening price of a bar right and if I fail to get the opening price to exit?
Sketched out a few options. But maybe there is a better and more correct code?
How do I get the opening price of a bar right and if I fail to get the opening price to exit?
Sketched out a few options. But maybe there is a better and more correct code?
The iXXXX functions only make sense if you are running a one-time request, without loops and without calling any other iXXXX functions.
If you only need to get the opening price once, then seeiOpen's help:
Return value
*** 0 in case of error.
So you need to query the price and check if it is zero: if it is not zero then the price is received, if it is zero then it is an error.
enum Symboll_ { AUDUSD=0, NZDUSD=1, USDCAD=2, USDCHF=3, USDJPY=4, EURJPY=5, EURUSD=6, GBPUSD=7, #CL =8 };The iXXXX functions only make sense if you are running a one-time request, without cycles and without calling any other iXXXX functions.
If you only need to get the opening price once, seeiOpen help:
Return value
*** 0 in case of error.
So you need to query the price and check that it is zero: if it is not zero then the price is received, if it is zero then it is an error.
Thank you. One more question. Should we use parentheses in this code or it makes no difference?
Can you please tell me how to insert the 9 parameter with a grid (#CL) so that the compiler doesn't generate an error?
Like this:
Thank you. One more question. Should brackets be used in this code or does it make no difference?
It will do. Generally speaking, brackets are intended for a group of actions. If there is only one action, they are of no use.
There you go:
Thank you very much!
Because I tried it like this and it didn't work:
enum Symboll_ { SIM_0, //AUDUSD SIM_1, //NZDUSD SIM_2, //USDCAD SIM_3, //USDCHF SIM_4, //USDJPY SIM_5, //EURJPY SIM_6, //EURUSD SIM_7 //#CL };Thank you very much!
Because I tried it like this and it didn't work:
Or like this:
or this:
That's the one!
In those variants it came out either just a serial number orSIM_1,...etc.