[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 364

 
Zhunko:

I'm not a programmer. I've just been getting into it for the last six years. It's a sport. You have to win.

Vadim, do you have children, if it's not a secret?
 
Zhunko:

I'm not a programmer. I've just been getting into it for the last six years. It's a sport. You have to win.

So you are at the beginning of your way. In three years, if you are patient enough, you will realize that you have to create your own one. It does not resemble anything else.

MQL4 is very similar to C. C++ is a totally different language. With infinite possibilities.


I've read on forums who have been creating something of their own since 2000, and as I see nothing of substance has been created (otherwise I wouldn't be sitting on them). What not to create, and all the same takes as a basis for something commonly known (the wheel is not wooden now, but again, no one invents it).
 
FelixFX:

I have read on the forums, who since 2000 has created something of their own, and as I see it did not create anything sensible (otherwise I would not have sat on them). What do not create, and all the same, based on something commonly known (the wheel is not wooden now, but again, no one invents it).
)) After all, we have already been told that it's more of a sport than a necessity. Let people have fun, it's better than drinking whisky).
 
nadya:
Vadim, do you have children, if it's not a secret?

Why, can you arrange it?

Sometimes it's better to just drink whiskey than to do shit... Too bad we're out of blue label.

 
splxgf:

Why, can you arrange it?

Sometimes it's better to just drink whiskey than to do shit... Too bad we're out of blue label.

No, I can't do that, one kid is enough for me for now. It's just that when there are no kids, you can do whatever you want, and when there are, it's all about distributing your time wisely. In that case, the child is more likely to choose daddy at the computer than when he is drunk.
 

Good afternoon!

I have a question: The EA is configured to trade on several dozen currency pairs (in a single pair window). If any of the pairs is not displayed in the Market Watch window, it causes a glitch. How can I programmatically check if these currency pairs are available to trade, or maybe they are just not displayed in the Market Watch?

 

Hello! Does anyone know how an EA can be prescribed on mt-4?

Is there a code where it needs to be prescribed for the EA to be displayed in mt?!

Thank you very much in advance!!!!!

 
Chekh:

Hello! Does anyone know how to register an EA on mt-4?!

Is there a code where it needs to be prescribed for the EA to be displayed in mt?!

Thank you very much in advance!!!!!

Let's be more specific, do you have the code ready? What extension is it in?
 

How do I select the position closest to the buy and sell price at the same time?

//+----------------------------------------------------------------------------+
//| Возвращает тикет ближайшей к рынку позиции по цене открытия или 0 |
//| Параметры: |
//| sym - наименование инструмента ("" - текущий символ) |
//| op - операция (-1 - любая позиция) |
//| mn - MagicNumber (-1 - любой магик) |
//+----------------------------------------------------------------------------+
int TicketNearPosOnOpen(string sym="", int op=-1, int mn=-1) {
double di=10000, pp;
int i, k=OrdersTotal(), t=0;

if (sym=="") sym=Symbol();
for (i=0; i<k; i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol()==sym && (op<0 || OrderType()==op)) {
if (OrderType()==OP_BUY || OrderType()==OP_SELL) {
if (mn<0 || OrderMagicNumber()==mn) {
if (OrderType()==OP_BUY) pp=MarketInfo(sym, MODE_BID);
if (OrderType()==OP_SELL) pp=MarketInfo(sym, MODE_ASK);
if (di>MathAbs(OrderOpenPrice()-pp)) {
di=MathAbs(OrderOpenPrice()-pp);
t=OrderTicket();
}
}
}
}
}
}
return(t);
}

It only selects the order which was last triggered, but does not select the buy (or sell) position.
 
vilard:

How do I select the position closest to the buy and sell price at the same time?

//+----------------------------------------------------------------------------+
//| Возвращает тикет ближайшей к рынку позиции по цене открытия или 0 |
//| Параметры: |
//| sym - наименование инструмента ("" - текущий символ) |
//| op - операция (-1 - любая позиция) |
//| mn - MagicNumber (-1 - любой магик) |
//+----------------------------------------------------------------------------+
int TicketNearPosOnOpen(string sym="", int op=-1, int mn=-1) {
double di=10000, pp;
int i, k=OrdersTotal(), t=0;

if (sym=="") sym=Symbol();
for (i=0; i<k; i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol()==sym && (op<0 || OrderType()==op)) {
if (OrderType()==OP_BUY || OrderType()==OP_SELL) {
if (mn<0 || OrderMagicNumber()==mn) {
if (OrderType()==OP_BUY) pp=MarketInfo(sym, MODE_BID);
if (OrderType()==OP_SELL) pp=MarketInfo(sym, MODE_ASK);
if (di>MathAbs(OrderOpenPrice()-pp)) {
di=MathAbs(OrderOpenPrice()-pp);
t=OrderTicket();
}
}
}
}
}
}
return(t);
}

It only selects the order which was last triggered, but it does not select the buy (or sell) position.


Define the term according to you "... The nearest to the buy and sell price at the same time..." - how does it mean simultaneity?

replace this penultimate line return(t); with this

return(OrderType());
Reason: