[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 296

 
Synax писал(а) >>
Please advise! How to make my Expert Advisor run every 30 minutes starting at 00.00 and ending at 23.00. One minute it works, and then again in 30 minutes. Thanks in advance!

Use

TimeCurrent( )
и
TimeHour( datetime time)

 

How do I know the time of the next bar?

The task is to display a text object to the right of the zero bar. What time should I specify?

 
Bond >> :


How do I know what time the next bar is?

Time[0] + Period() * 60

 
Or else: Time[0]+(Time[0]-Time[1]) or 2*Time[0]-Time[1].
 

Friends, good afternoon.


If you get a chance, please advise on how to deal with these difficulties:


https://www.mql5.com/ru/forum/118878/page3


https://forum.mql4.com/ru/27282




Thank you very much in advance.

 
granit77 >> :

I've come across it more than once. And every time in the end a simple reason was found.

I'll look into it. Just a thought - maybe it has something to do with the default settings in the template or profile.

 

Question about order closing

My code does not want to close all orders, what might be the problem?

for(int cnt=0; cnt < OrdersTotal(); cnt++)
   {
      OrderSelect( cnt, SELECT_BY_POS, MODE_TRADES);
      if(OrderType() == OP_BUY)
         {
            if( BuyExit != 0)
               {
                  OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet);
               }
         }
      if(OrderType() == OP_SELL)
         {
            if( SellExit != 0)
               {
                  OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet);
               }
         }
   }  

I.e. my advisor opens 5 BUY orders and should close 5 BUY orders too but it closes only 4 or 3 for some reason I have not understood the reason why it decides how many orders it will close

Please give advice or help in code.

Thank you

 
Question. Is it possible to use OLE objects in the tracker? I searched the forum and found out that I have to create a dll wrapper. Are there simpler ways to do this?
 
Run писал(а) >>

Question about order closing

I don't want to close all orders, what might be the problem?

I.e. my Expert Advisor opens 5 BUY orders and should close 5 BUY orders too but it closes only 4 or 3 for some reason I do not understand what principle it uses to decide how many orders to close

Please help me with advice or code.

Thank you

Reverse cycle to close

for(int cnt=OrdersTotal()-1; cnt >=0 ; cnt--)
 
Vinin >> :

Do the closing cycle in reverse

Thank you it all worked only now to understand why it works and another does not work (does not work correctly)

Reason: