MQL5 ReferenceStandard LibraryTrade ClassesCPositionInfoMagic TimeTimeMscTimeUpdateTimeUpdateMscPositionTypeTypeDescriptionMagicIdentifierVolumePriceOpenStopLossTakeProfitPriceCurrentCommissionSwapProfitSymbolCommentInfoIntegerInfoDoubleInfoStringSelectSelectByIndexSelectByMagicSelectByTicketStoreStateCheckState Magic Gets the ID of Expert Advisor that opened the position. long Magic() const Return Value ID of the Expert Advisor that opened the position. Note The position should be selected using the Select (by ticket) or SelectByIndex (by index) methods. TypeDescription Identifier