Hi all. My history search doesn't return the volume of lots. Is this the way to do it?
It returns the lot 0.1, although lots are changed by the program. tickets are displayed correctly (change). a bug? a bug?
See code analogue, edit, try:
//---------------------расчет по истории ордеров номера очередной итерации-----------------------------------------------
Iteration = 0; // зануляем инерации перед их учетом в цикле по истории
Sum_Loss = 0; // суммарный убыток по этим итерациямdatetime
Time_at_History_Current = 0,
Time_at_History_Previos = 0;
if(OrdersHistoryTotal() != 0)
{
for(int counter = OrdersHistoryTotal()-1; counter >= 0; counter--)
{
OrderSelect(counter, SELECT_BY_POS, MODE_HISTORY);
if(OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber)
{
if(OrderType() == OP_BUY || OrderType() == OP_SELL)
{
if(OrderProfit() < 0) // если убыток по выбранному ордеру, то считаем суммарный и записываем время закрытия ордера// для последующего его анализа при подсчете количества итераций
{
double lastLoss = OrderProfit();
Sum_Loss=Sum_Loss+lastLoss; // считаем общий убыток по закрытым подряд убыточным ордерам
Time_at_History_Current = OrderCloseTime();
}
//Print(" Time_at_History_Current_в цикле = ", TimeToStr(Time_at_History_Current, TIME_DATE|TIME_SECONDS));//Print(" Time_at_History_Previos_в цикле = ", TimeToStr(Time_at_History_Previos, TIME_DATE|TIME_SECONDS));if(Time_at_History_Current != Time_at_History_Previos) // если они не равны, то считаем итерации и делаем их равными
{
Time_at_History_Previos = Time_at_History_Current ;
Iteration++;
//Print("Iteration at History в условии сравнения = ", Iteration);
}
else// они равны, то проверяем, дополнительно, наличие профита по выбранному следующему ордеру и выходим из цикла
{
if(OrderProfit() >= 0)
break;
}
}
}
}
}
I don't need a cycle. I need to get the LOT of the last order, no matter which one, I don't need filtering. There is nothing about LOT in the example. I am puzzled.
I don't need a cycle. I need to get the LOT of the last order, no matter which one, I don't need filtering. There is nothing about LOT in the example. I am puzzled.
Have a look - I've made edits to my previous post...
I don't get it. A loop is needed when you need to filter by some criteria, like in your case. My task is simpler - to take the last order from the history. By definition, it is closed, and by definition, there are no open positions in the market. Pending orders are not used. I.e., the last order will definitely be the market one. Tickets are returned correctly, lots are not.
Pyro: I don't get it. A loop is needed when you need to filter by some criteria, like in your case. My task is simpler - to take the last order from the history. By definition, it's closed, and by definition, there are no open positions in the market. Tickets are returned correctly, lots are not.
Thanks for wanting to help. I put if (D_sig==0) { command for signal ; }. "Steps" became less, but still they are there. And it is not clear how they are formed.
I put MathAbs in order to have a "corridor" for comparison, because the probability that the signal lines will be absolutely equal is negligibly small.
Maybe someone else has thoughts on my problem?
I wrote it like this and it displays D_Sig in the comment.
Hi all. My history search doesn't return the volume of lots. Is this the way to do it?
It returns the lot 0.1, although lots are changed by the program. tickets are displayed correctly (change). a bug? a bug?Hi all. My history search doesn't return the volume of lots. Is this the way it's supposed to be?
It returns 0.1 lots, although lots are changed by the program. Tickets are reflected correctly (changed).Don't look for "bugs and features" in everything - sometimes the door opens very simply ... :-)
Where's the order loop?
Hi all. My history search doesn't return the volume of lots. Is this the way to do it?
It returns the lot 0.1, although lots are changed by the program. tickets are displayed correctly (change). a bug? a bug?See code analogue, edit, try:
Roman
I don't need a cycle. I need to get the LOT of the last order, no matter which one, I don't need filtering. There is nothing about LOT in the example. I am puzzled.
Roman
I don't need a cycle. I need to get the LOT of the last order, no matter which one, I don't need filtering. There is nothing about LOT in the example. I am puzzled.
Have a look - I've made edits to my previous post...
I don't get it. A loop is needed when you need to filter by some criteria, like in your case. My task is simpler - to take the last order from the history. By definition, it's closed, and by definition, there are no open positions in the market. Tickets are returned correctly, lots are not.
Own! Learn to use the search! :-)
Thanks for wanting to help. I put if (D_sig==0) { command for signal ; }. "Steps" became less, but still they are there. And it is not clear how they are formed.
I put MathAbs in order to have a "corridor" for comparison, because the probability that the signal lines will be absolutely equal is negligibly small.
Maybe someone else has thoughts on my problem?
I wrote it like this and it displays D_Sig in the comment.