[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 277

 
Pyro:

Can you tell me why OrderOpenPrice doesn't work? The task is to look for an order in the pool at a certain price, and if it's not there, put the order and set a flag that it's set.


Use the ready-made function

Function ExistPosByPrice().


https://www.mql5.com/ru/forum/131859/page2#434212
 
artmedia70:

Read the last line of my post. Who said I was writing a closing example?

The rest of it is the plain truths. Write your own textbook.

Clarified not for you. My post is purely for beginners. So there is no need to be offended.
 

I cannot put the divergence signal from the indicator into my EA.

Indicator FX5_Divergence_V2.1.mq4


How do I take the arrow out of the indicator?

 
bolt:
Clarified not for you. My post is exclusively for newcomers. So there is no need to be offended.
Offended? God forbid! There was a comment on my post, respectively, and treatment is taken to the author of commented post. Everything is OK.
 
artmedia70:

You know, if you have only one order, it might work, but if you still open it manually, it won't be the same. The ticket number should be stored in a variable, and after selecting an order, we should compare its ticket with the stored one:

And in general, the order selection must be done using the OrderSelect() function in the loop:

This is just an example for understanding, not the finished working code, if anything... :)





Thank you!)))
 
bolt:

When closing orders, if there is more than one order, a cycle like this should be used:



Thank you too!))
 
Sergey_Rogozin:

I cannot put the divergence signal from the indicator into the Expert Advisor.

Indicator FX5_Divergence_V2.1.mq4


How do I take the arrow out of the indicator?

The 2nd and 3rd buffers the indicator. The second is the up arrow and the third is the down arrow. Use iCustom(); with data check of these buffers.
 
Pyro:

Can you tell me why OrderOpenPrice doesn't work? The task is to look for an order in the pool at a certain price, if it's not there, put the order in and flag it as set.

It goes something like this:

int   dg=MarketInfo(Symbol(), MODE_DIGITS);
orderset=false;
for (int i=0; i<OrdersTotal(); i++) {
   if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) {
      if (OrderSymbol()!=Symbol())        continue;
      if (OrderType()<2 || OrderType()>5) continue;
      if (OrderMagicNumber()!=Magic)      continue;
      if (NormalizeDouble(OrderOpenPrice()-price,dg)==0) {
         orderset=true;
         break;
         }
      }
   }
if(!orderset) {
   int ticket=OrderSend(Symbol(),OP_SELLLIMIT,baselot,price,3,NULL,price-10,"Comment",0001+i,0,White);
   if (ticket<0) Print("Не удалось выбрать ордер, ошибка ", GetLastError());
   else price=OrderOpenPrice();
   }
I wrote it by hand - don't kick me... :)
 
artmedia70:
The 2nd and 3rd buffers the indicator. The second is the up arrow and the third is the down arrow. Use iCustom(); with data check of these buffers.
These buffers are empty. Produce the same value 27.........., in short, lots of numbers that never change...
 
Sergey_Rogozin:
These buffers are empty. They give the same value 27.........., in short, lots of numbers that never change...

They only change on the bar with the arrow. Press Ctrl+D and move the mouse over the indicator chart, observing the data of these buffers. You owe me a beer :))

ZS. These numbers are nothing but EMPTY_VALUE (empty buffer value)

Reason: