Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1564

 
Nauris Zukas position comments. How can I find out which Magic is set in the environment?

First you need to select the position you are going to work with using one of the functions below:

PositionGetSymbol

Returns the symbol of the corresponding open position

PositionSelect

Selects an open position for further work with it.

PositionSelectByTicket

Selects an open position for further work with it according to the specified ticket.

but just note that the PositionSelect() and PositionSelectByTicket() functions have a peculiarity:

PositionSelect() и PositionSelectByTicket()  копируют данные о позиции в программное окружение, и последующие вызовы PositionGetDouble(), PositionGetInteger() и 
PositionGetString() возвращают ранее скопированные данные. Это означает, что самой позиции может уже и не быть (или же она изменилась по объему, 
направлению и т.д.), а данные этой позиции можно еще получать. 
Для гарантированного получения свежих данных о позиции рекомендуется вызывать функцию PositionSelect() и PositionSelectByTicket() непосредственно перед обращением за ними.

then you need to get its Magic:

ulong position_magic = PositionGetInteger(POSITION_MAGIC);

and then you can use position_magic where you want.

Regards, Vladimir.

 
MrBrooklin #:

First select the position you are going to work with using one of the functions below:

PositionGetSymbol

Returns the symbol of the corresponding open position

PositionSelect

Selects the open position for further work with it.

PositionSelectByTicket

Selects an open position for further work with it by the specified ticket

but just note that the PositionSelect() and PositionSelectByTicket() functions have a peculiarity:

Then you need to get its Magic:

and then you can use position_magic wherever you want.

Regards, Vladimir.

The question was about something else
 

I even wondered, then what was the question?

Regards, Vladimir.

 
MrBrooklin #:

I was wondering, what was the question then?

Regards, Vladimir.

What magik is installed in the trading facility. I'd answer, but I'm not at my computer yet.