Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 738
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 message still comes up at the 12th minute.
Insert Print, at the beginning of the function where the array is filled
and show the number of values in the second dimension
I can tell from everything that NomNews gets into the While loop already in a state greater than 999. Then you need to find out why it happens and reset this variable somewhere.
To check this, write it at the beginning of the loop:
Yes, at the 11th minute the print is 1000.
Insert Print, at the beginning of the function where the array is filled
and show the number of values in the second dimension
I inserted it at the beginningof the Whileloop and got the infiniteRange = 1000. Did I insert it in the wrong place?
What is this number (or function?): datetime TimeNewsFunck(int nomf)
{
string s=NewsArr[0][nomf];
string time=StringConcatenate(StringSubstr(s,0,4),".",StringSubstr(s,5,2),".",StringSubstr(s,8,2)," ",StringSubstr(s,11,2),":",StringSubstr(s,14,4));
return((datetime)(StringToTime(time) + GMTplus*3600))
}
And where does it get the value of int nomf ? I couldn't find it.
I inserted it at the beginningof Whileloop and got infiniteRange = 1000. Did I put it in the wrong place?
And what is this number (or function?): datetime TimeNewsFunck(int nomf)
{
string s=NewsArr[0][nomf];
string time=StringConcatenate(StringSubstr(s,0,4),".",StringSubstr(s,5,2),".",StringSubstr(s,8,2)," ",StringSubstr(s,11,2),":",StringSubstr(s,14,4));
return((datetime)(StringToTime(time) + GMTplus*3600))
}
And where does it get the value of int nomf ? I have not found it.
And then there is the function which I tried but failed to find out. May it be the source of the problem?
And then there's a function that I haven't been able to figure out, no matter how hard I've tried. Maybe that's where the problem lies?
Only the author will figure it out himself. You'd better send the code from OnTick()
Yes, at the 11th minute it gave out print 1000.
Try replacing
with this line.
Excess((2*psd*usd)*((2*psd*usd)-C))/(C-1)) in the formula.
To exponentiate: ^0.5 is not *0.5
If there is not a single trade on the looked through symbol and majik, or there is not a single profit or loss, or there is only one pair (C=1), we will get the division by 0.
Before the formula itself, you should check that psd and usd are > 0, and C !=1
Profitable pairs are calculated with profit > 1, loss < 1, with profit=1 are not analyzed, i.e. 1 also has to be included somewhere in this or that group.
In your function, it would be better to first select transaction numbers matching the symbol and magic number and then check if their number has changed, if so - recalculate zn, if not - return zn (zn in this case do not zeroize and check != 0 will not be needed when printing)
Owl stops working, because it relies on variables ww and nn, and when your function works, they change and break the algorithm of the owl.
Nothing would have compiled if there had been a code design error.I can only say thank you. This is the only place in runet where they helped me.
Now the printer generates the following "Stop_Ma_v_5.1 EURUSD,M15: == Z-count equals = -nan(ind)" . Could you please advise what it means and the code should return the number?
Code :
Mql5 guys, can you help me make a request to close a position in a hedge account? Situation: opened BUY position, we need to close it with Sell Limit. Question: How do I correctly write a request, to close exactly chosen position, and not to open new SELL locking BUY? Please write a piece of code with comments! Thank you in advance!
Closing by one open order of another order opened at the same symbol but in opposite direction.
boolOrderCloseBy(
intticket,// number of order to close
intopposite,// number of the opposite order
colorarrow_color// colour
);
Parameters
ticket
[Unique order number of the order to be closed.
opposite
[A unique sequence number of the opposite order.
arrow_color
[The colour of the close arrow on the chart. If this parameter is not present or its value is CLR_NONE, the arrow is not shown in the chart.
Returned value
Returns true if the function succeeded or false if there was an error. To get the error information, call GetLastError().
Example:
if(iRSI(NULL,0,14,PRICE_CLOSE,0)>75)
{
OrderCloseBy(order_id,opposite_id;)
return(0);
}
P.S. This thread only parses MQL4
I can only say thank you. This is the only place in runet, where they helped.
Now the printer generates the following "Stop_Ma_v_5.1 EURUSD,M15: == Z-Account Equals = -nan(ind)". Could you please advise what it means and the code should return the number?
Code :
The closing of one open order by another order open for the same instrument, but in the opposite direction.
boolOrderCloseBy(
intticket,// number of order to close
intopposite,// number of the opposite order
colorarrow_color// colour
);
Parameters
ticket
[A unique sequential number of the order being closed.
opposite
[A unique sequence number of the opposite order.
arrow_color
[The colour of the close arrow on the chart. If this parameter is missing or its value is CLR_NONE, the arrow is not shown in the chart.
Returned value
Returns true if the function succeeded or false if there was an error. To get the error information, call GetLastError().
Example:
if(iRSI(NULL,0,14,PRICE_CLOSE,0)>75)
{
OrderCloseBy(order_id,opposite_id;)
return(0);
}
P.S. This thread only parses MQL4
No. Any questions on mql4 as well as mal5 are handled here in this thread, because the main purpose was to help not only with algorithms and codes but also to facilitate migration from mql4 to mql5.