How can I select the last 2 trades already closed (from the account history list)?
It should be something like this
how to write correct parameter to select?
The last two orders will have the numbers OrdersHistoryTotal()-1 and OrdersHistoryTotal()-2.
Here is a script to test
int start(){int i, accTotal=OrdersHistoryTotal();for( i=0; i< accTotal; i++){if(OrderSelect( i, SELECT_BY_POS, MODE_HISTORY)==false){Alert("Ошибка при доступе к исторической базе (",GetLastError(),")");break;}Alert( i,":",TimeToStr(OrderCloseTime()));}}
See: i=Bars-Period1+1 at the first iteration of the loop, we get k=i+Period1-1=Bars-Period1+1+Period1-1=Bars and then Close[k], which means we are already out of the array.
Correct: i=Bars-Period1-1
..................
Is there any way to find the maximum(min) of the close[i]/close[i+1] ratio, but without using arrays??? Thank you!
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 can I select the last 2 trades already closed (from the account history list)?
It should be something like this
how to write correct parameter to select?The last two orders will have the numbers OrdersHistoryTotal()-1 and OrdersHistoryTotal()-2.
Here is a script to test
>> Good luck!
the code is quite crude.
See: i=Bars-Period1+1 at the first iteration of the loop, we get k=i+Period1-1=Bars-Period1+1+Period1-1=Bars and then Close[k], which means we are already out of the array.
Correct: i=Bars-Period1-1
..................
Is there any way to find the maximum(min) of the close[i]/close[i+1] ratio, but without using arrays??? Thank you!
Is there any way to find the maximum(min.) of the close[i]/close[i+1] relationship, but without using arrays??? Thanks!
the question is where to write what the maximum will be searched for. this is usually called an array:) ArrayMax(in)imum is optimal
the question is where to write what the maximum will be searched for. this is usually called an array:) ArrayMax(in)imum -optimal
And if you write it into a buffer?
Is there any way to find the maximum(min.) of the close[i]/close[i+1] ratio, but without using arrays??? Thank you!
If I understood the question correctly. You can experiment not with close[i], but like this:
where Cbar, -number of last bars, among which an extremum is searched for
If I understood the question correctly. It is possible to experiment not with close, but like this:
where Cbar is the number of last bars among which the extremum is searched for
It is the absolute value of the ratio Prace[i]/Price[i+1] that interests me.
What if you put it in a buffer?
Isn't a buffer an array?
Isn't a buffer an array?
Yes, but if I write Buffer[i]=close[i]/close[i+1] and then use iHighest function, nothing works!!!!
Yes, but if I write Buffer[i]=close[i]/close[i+1] and then use iHighest function, then nothing happens!!!!
because iHighest only works with timeseries. For other arrays analog of ArrayMaximum