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

 
HoBu4ek >> :
Can you please advise how to make an EA open an order for multiple symbols at once? >> Thanks in advance!

This is not possible because the EA can open an order for only one symbol, and then you have to wait for the trade (and it is not always successful and not always fast) to release the trade flow for other orders.

 
Drugoy писал(а) >>

Gentlemen, please advise a newcomer! I downloaded the tutorial MQl4BookRussian.chm (author Sergey Kovalev), the problem is that printing from this format is very messy. Probyby copied this text to doc format, images disappear. Do you know if the textbook is available in a format suitable for printing (for reading on a monitor, eyes are getting tired)?

Try the online version of the textbook directly from the website - https://book.mql4.com/ru/. And you can transfer it to doc without any problems.

 
Reshetov >> :

This is not possible because an EA can only open an order on one symbol, after which you have to wait for the trade operation to go through (and it is not always successful and not always fast) and the trade flow will become available for other orders.

With trade flow I understand everything, but how to make successively on 3 instruments with minimal interval opening deals (according to advisor's algorithm opening should start in a certain second on three currencies at once)? If you would not mind, could you post a code snippet as an example? I would be very grateful!

 
Dimoncheg >> :

int start()
{
if (OrdersTotal() == 0
&& TimeDayOfWeek(TimeCurrent()) == 5
&& TimeHour(TimeCurrent()) == 12
&& TimeMinute(TimeCurrent()) == 30
&& TimeSeconds(TimeCurrent()) >= 00)
{
Alert("Тра ляля");
OrderSend(Symbol(),OP_SELL,Lots,Bid,3,0,0,"sell",999999,0,Red);
}


No one knows why no order opens here? What am I doing wrong?

If this is the whole code, it doesn't even compile. If you put a number in place of Lot, the EA works fine.


 
HoBu4ek >> :

I understand everything with the trade flow, but how to make deals open consecutively on 3 symbols with minimal intervals (according to the EA's algorithm, the opening should start in a certain second on three currencies at once)? If you would not mind, could you post a code snippet as an example? I will be very thankful!

I guess you just need 3 orders to open for different instruments? Why not make a flag variable for example

Create in global variables

int flag=0;
string Symb;

///////////////

further

int start()
{
if (условие открытия)
{flag=1;}

if (flag==1)
{
Symb="EURUSD";
OrderSend(Symb,...)///Открываем, переносим флаг во 2 состояние для открытия след ордера и
flag=2; ///выходим тк больше мы ни чего не можем сделать
return(0);
}

if (flag==2)
{
Symb="AUDUSD";
OrderSend(Symb,...)
flag=3;
return(0);
}

if (flag==3)
{
Symb="USDJPY";
OrderSend(Symb,...)
flag=0;//Возвращаем флаг в начальное состояние..
return(0);
}
return(0);}


It would also be nice to add an open check and only move the flag after the check is successful.

 
Inzer >> :

If this is the whole code, it doesn't even compile. If you substitute a number for Lot, the Expert Advisor works fine.


Check the data type of Lot. It should be double.

 
TheXpert >> :

So, just at a glance. I did not understand the terms, but in the second version there seems to be no crossover.

One more thing -- the OrderSend function returns an int ticket, so it's correct to check for success like this:

In your case, you need to check for incorrectness:

______

Yes, I do not know how others, but for me the word "experts" sounds like a mockery. Maybe that's why you haven't heard back for so long. ;)

Hello!!!!!!!!!!!!!!

Yes, whatever you say........ do not call it so do not call it..... Although experts is abbreviated from specialists (people with knowledge, teachers, so to speak).

I do not care...... I meant only positive and kind ........

Never mind........

At the very beginning of this thread I asked about the MA. I got some very clever answers. Now I'm back to it again.

One idea came up.....

int start()
  {
//----
    double MA_0=iMA(NULL, 0, pMA, pSh, mode, price,0);
    double MA_1=iMA(NULL, 0, pMA, pSh, mode, price,1);
        
    if( MA_1< Open[1] && MA_0>Open[0])
     if( CheckOrders(OP_SELL))//продажа
      {
       if(!OrderSend(Symbol(), OP_BUY, Lots, Ask, 3, 0, 0, NULL, MagicNumber))
         Print("Не открыт ордер Buy. Ошибка №", GetLastError()); 
       }
       
    if( MA_1>Open[1] && MA_0<Open[0])
     if( CheckOrders(OP_BUY))//покупка
      {
       if(!OrderSend(Symbol(), OP_SELL, Lots, Bid, 3, 0, 0, NULL, MagicNumber))
         Print("Не открыт ордер Sell. Ошибка №", GetLastError()); 
       }
//----
   return(0);
  }

I decided to tweak the trading conditions a bit. But it did not work(((((((( I wanted to put open_1 and open_0 (open price on the first bar and

Open price on a zero bar) When I checked it gave errors, I had to return to the original version (which I have given above).

As it was explained to me open[1] is a call of array cell with name open and index [1]. All this is good...... but only need an open price on 1(2,0) bar

Tips for the dummy.....)))))))).....

 
How can I track if a pending order has triggered (e.g. buy order) ? Is it better to search for it by id in the history or is there a shorter option?
 
fima_ >> :
How to track that the pending order has triggered (for example, on buy) ? Is it better to search it by its id in the history or there is a shorter option?

You could try this

OrderSelect(1, SELECT_BY_POS)

if(OrderOpenTime()!=0)

{

///необходимая операция

}

But this is only an option if you only have 1 order!

 
What function is used to determine the pip value of a financial instrument? For example, for EURUSD, the value of 0.0001 is $10 (when trading 1 lot)