just to add, it is NOT GUARANTEED that the terminal has and will give sufficient history.
in the above example there is no reference to history
so it is guaranteed that the result of OrderSelect() is true
UPD: OrderSelect in 4 works very well, tested it once - for market orders the time of access to order properties.... it really is millions of times per second, i don't want to look it up, i think i was arguing with moderator Artem, but it's like they say "all tiptoes differ", if you like it, keep it
@Igor Makanu, thank you very much for your answers about sorting orders in the terminal. I'll probably save them as an array of structures and sort it myself. My doubts were mainly because I feared that such actions performed on every tick would have a noticeable negative impact on performance.
Janis Ozols: @Igor Makanu, thank you very much for your answers about sorting orders in the terminal. I'll probably save them as an array of structures and sort it myself. Doubts were mainly because I feared that such actions performed on every tick would have a noticeable negative impact on performance.
So why sort on every tick? Enough only when the number of entries changes or the list changes completely...
in the above example there is no reference to history
so it is guaranteed that the result of OrderSelect() is true
UPD: OrderSelect in 4 works very well, I was testing it once - for market orders the time of access to order properties.... it really is millions of times per second, i don't want to look it up, i think i was arguing with moderator Artem, but as they say "all tip-toes are different", i like it - keep it
Moderator Artem is not arguing. Moderator Artem is debating :)
Why does isCrossing() not return 2??? The isCrossing() itself has a second if entry, but then there is no ifentry inOnTick() when isCrossing() == 2. What is this nonsense...
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.
just to add, it is NOT GUARANTEED that the terminal has and will give sufficient history.
in the above example there is no reference to history
so it is guaranteed that the result of OrderSelect() is true
UPD: OrderSelect in 4 works very well, tested it once - for market orders the time of access to order properties.... it really is millions of times per second, i don't want to look it up, i think i was arguing with moderator Artem, but it's like they say "all tiptoes differ", if you like it, keep it
Hello, there is a need for data on the drawdown of each transaction.
Can anyone meet a script to collect such statistics and output in the form of a report?
Thank you
Hello, there is a need for data on the drawdown of each transaction.
Can anyone meet a script to collect such statistics and output in the form of a report?
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);
}
it is "handwritten", untested, full of bugs :-) just tweak it to your needs and use it
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, full of errors :-) adjust to your needs and use
thanks, I'll try to figure it out!
@Igor Makanu, thank you very much for your answers about sorting orders in the terminal. I'll probably save them as an array of structures and sort it myself. Doubts were mainly because I feared that such actions performed on every tick would have a noticeable negative impact on performance.
So why sort on every tick? Enough only when the number of entries changes or the list changes completely...
in the above example there is no reference to history
so it is guaranteed that the result of OrderSelect() is true
UPD: OrderSelect in 4 works very well, I was testing it once - for market orders the time of access to order properties.... it really is millions of times per second, i don't want to look it up, i think i was arguing with moderator Artem, but as they say "all tip-toes are different", i like it - keep it