Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1601

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
This one goes from index zero, i.e. from the beginning.
This one searches from zero index, i.e. from the beginning.
This one goes from zero index, i.e. from the beginning.
Ahh... Now it all makes sense, thank you.
for(int i=OrdersTotal()-1;i>=0;i--) {
if (! OrderSelect(i,SELECT_BY_POSITON,MODE_TRADES)) continue;
double prosad=DBL_MIN;
if (OrderType()!=OP_BUY && OrderType!=OP_SELL) continue;
for(int j=iBarShift(OrderSymbol(),OrderOpenTime(),PERIOD_M1); j>=0;j--) {
double delta=( OrderType()==OP_BUY? OrderOpenPrice()-iLow(OrderSymbol(),PERIOD_M1,j) : iHigh(OrderSymbol(),PERIOD_M1,j)-OrderOpenPrice() );
delta /= MarketInfo(OrderSymbol(),MODE_POINT);
if (delta>prosad) prosad=delta;
}
PrintFormat("Максимальная просадка по ордеру %d = %d пунктов , %f денег",OrderTicket(),(int)(prosad),prosad*OrderLots()*MarketInfo(OrderSymbol(),MODE_TICKVALUE);
}
written "by hand", untested, full of errors :-) adjust it to your needs and use it
please tell me what -"!" means in your code ?
i don't understand it too well yet
or maybe someone else can explain it to me, besides the author?
please tell me, what does -"!" mean in your code?
I don't really understand it yet.
or can someone else explain it to me besides the author?
! - this is a boolean negation, NOT
if { !OrderSelect() } translates to "if OrderSelect is NOT successful"
!= respectively "NOT equal"
! - is a Boolean negation, NOT
if { !OrderSelect() } translates as "if NOT successful OrderSelect"
!
thanks
for(int i=OrdersTotal()-1;i>=0;i--) {
if (!OrderSelect(i,SELECT_BY_POSITON,MODE_TRADES)) continue;
double prosad=DBL_MIN;
if (OrderType()!=OP_BUY && OrderType!=OP_SELL) continue;
for(int j=iBarShift(OrderSymbol(),OrderOpenTime(),PERIOD_M1); j>=0;j--) {
double delta=( OrderType()==OP_BUY? OrderOpenPrice()-iLow(OrderSymbol(),PERIOD_M1,j) : iHigh(OrderSymbol(),PERIOD_M1,j)-OrderOpenPrice() );
delta /= MarketInfo(OrderSymbol(),MODE_POINT);
if (delta>prosad) prosad=delta;
}
PrintFormat("Максимальная просадка по ордеру %d = %d пунктов , %f денег",OrderTicket(),(int)(prosad),prosad*OrderLots()*MarketInfo(OrderSymbol(),MODE_TICKVALUE);
}
written "by hand", not checked, has a lot of errors :-) adjust it to your needs and use it
I may have "cleaned up" the code, but this line shows a warning for(int j=iBarShift(OrderSymbol(),OrderOpenTime(),PERIOD_M1); j>=0;j--)
possible loss of data due to type conversion
Can't figure out what's wrong?
I seem to have "cleaned up" the code, but on this line for(int j=iBarShift(OrderSymbol(),OrderOpenTime(),PERIOD_M1); j>=0;j--) the warning appears:
possible loss of data due to type conversion
I can't figure out what's wrong?
I mixed up the parameters...it's a common mess when it's written "on the fly" right into the forum bypassing the terminal
iBarShift(OrderSymbol(),PERIOD_M1,OrderOpenTime()) should be
Parameters mixed up...common confusion when writing "on the fly" directly into the forum bypassing the terminal
iBarShift(OrderSymbol(),PERIOD_M1,OrderOpenTime()) should be
thanks
I seem to have cleaned up the code, but on this line for(int j=iBarShift(OrderSymbol(),OrderOpenTime(),PERIOD_M1); j>=0;j--) the warning appears:
possible loss of data due to type conversion
I can't figure out what's wrong?
I can't really understand what's wrong? Can I attach this whole "thing" to my Expert Advisor and run it through the strategy tester with output of the information in the test report?
will it work?
Any tips on how to deal with this?
In the tester on the history a simple order opening sometimes causes an error...
ERR_INVALID_TRADE_PARAMETERS - what the hell is this and what does it mean?