Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 430
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
wrote this code.
the meta-editor mumbles.
Why does it mate?
#property strict
Is your pr initialized?
wrote this code.
the meta-editor mumbles.
Why does it mate?
#property strict
It clearly says that on line 553 it's possible to use a variable that has no value. Try to write bool pr=false; This will fool the compiler but you'd better check it properly. After all, if the order type is a pending order, you will still have pr without a value...
on the previous one, and what's here from mql4? the OnTick() function?
The question was addressed in the article about mql4 language, so I immediately noticed Time[0].
After a closer look, it becomes clear that it is a user-defined array.
And here is a comment from the documentation:
Note
The function uses synchronous calling - it means that the function waits for execution of all commands that were placed in the chart queue before it was called, so this function might be time-consuming. You should keep this in mind if you work with a large number of objects on the chart.
Since an object in one price coordinate can have several values, it is necessary to specify the line number. This function can be applied only to the following objects:
Is your pr initialised?
I thought it was initialized by zero when declared.
It clearly says that in line 553 it is possible to use a variable which has no value. Try to write bool pr=false; This will fool the compiler, but it's better to check everything properly. After all, if the order type is a pending order, you will still have pr without value...
thanks for reminding me about the pending orders)
Is this the right way to do it?
thanks for reminding me about the pending orders)
is this the right way to do it?
if (pr==false) is equivalent to if (!pr)
if (pr==true) is equivalent to if (pr)
I use Alert instead of Print - it should appear right away without opening the journal. And there is no extra information
if (pr==false) is equivalent to if (!pr)
if (pr==true) is equivalent to if (pr)
I use Alert instead of Print - it shows up instantly on the screen without opening the journal. And there is no extra information
We get OrderClosePrice() after the transaction is closed.
Is it possible to write OrderClosePrice() like this?
We receive OrderClosePrice() after the trade is closed.
You can. But be careful. For an open position, it returns the closing price. Correspondingly: for Buy - Bid, for Sell - Ask