[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 464

 
Mepkypuu писал(а) >>
Can you please tell me why this function does not work? It should return the number of pending orders since the last successful order.

Assuming that no more than one position is open at a time, the following can be done

  int GetLosses ()
   {  
      int Out       = 0;
      int Counter;
      for ( Counter=OrdersHistoryTotal()-1; Counter >=0 ; Counter--)
      {
         OrderSelect( Counter, SELECT_BY_POS, MODE_TRADES);
         if (OrderProfit() > 0)  break;
         Out++;
      }  
      return ( Out);
   }
 
Vinin >>:

Если предположить что одновременно открыто не более одной позиции, то можно сделать так


Unfortunately, it doesn't work: it just counts open orders. I don't know what the problem is myself, but it's probably not in the code.
 
Mepkypuu писал(а) >>

Unfortunately, it doesn't work: it just counts open orders. Not sure what the problem is myself, but it's probably not in the code.

Sorry

  int GetLosses ()
   {  
      int Out       = 0;
      int Counter;
      for ( Counter=OrdersHistoryTotal()-1; Counter >=0 ; Counter--)
      {
         OrderSelect( Counter, SELECT_BY_POS, MODE_HISTORY);
         if (OrderProfit() > 0)  break;
         Out++;
      }  
      return ( Out);
   }
 
When the history of deals disappeared I was offered to set *show all history* but there is no such a setting, the terminal is the 4th metatrader, used by several DTs.
 
kraizislot писал(а) >>
When the history of transactions disappears, they suggested me to set *show all history* but there is no such a setting, the terminal is the 4th metatrader, used by several DTs.

In the account history window you right-click and select all history

 
Good afternoon, I have the following question. The start() function in EA is executed after each tick. What will happen if I have sent a request for OrderSend(), but the answer came two minutes later, and some ticks arrived in the meantime? I guess, the execution will not start again, e.g. in another thread, etc., until the start() function finishes? I mean, there won't be a situation when I send ten more requests during these 2 minutes? Or it won't be possible to execute OrderSend() several times, because the trade thread will be busy or something? Thank you
 
Maxim_M писал(а) >>
Hi, I have the following question. Function start() in Expert Advisor is executed after each tick. What will happen if I have sent a request OrderSend(), but the reply comes two minutes later, and during this time there are several ticks? I guess, the execution will not start again, e.g. in another thread, etc., until the start() function finishes? I mean, there won't be a situation when I send ten more requests during these 2 minutes? Or it won't be possible to execute OrderSend() several times, because the trade thread will be busy or something? Thank you

until the start function is finished, the Expert Advisor will not wait for ticks, so new ticks that are missed before the current request is finished will not be processed.

 
Vinin >>:

Сорри

  int GetLosses ()
   {  
      int Out       = 0;
      int Counter;
      for ( Counter=OrdersHistoryTotal()-1; Counter >=0 ; Counter--)
      {
         OrderSelect( Counter, SELECT_BY_POS, MODE_HISTORY);
         if (OrderProfit() > 0)  break;
         Out++;
      }  
      return ( Out);
   }



Aah! Right! Thank you very much! It works now.

 
In the Fractals indicator fractals are displayed at a certain distance from extrema, how can this be done in a custom indicator?
 
sanyooooook писал(а) >>
In the Fractals indicator the fractals are drawn at a certain distance from the extrema, how to do that in a custom indicator?

On the 3rd or 4th candlestick you put a fractal in the indicator buffer, if the conditions are met

Reason: