# MQL5 HistoryDealGetString()

Independent and unofficial. Not affiliated with or endorsed by any broker or platform named here. Educational only: nothing here is advice, and nothing here recommends a broker or a trade.

This is the markdown version of https://openbrokerapi.com/platforms/metatrader-5/functions/mql5-historydealgetstring, written from the same records as that page.

Risk warning: CFDs and spread bets are complex instruments and come with a high risk of losing money rapidly due to leverage. You can lose money on these products, and each provider publishes its own loss figure under FCA rules. You should consider whether you understand how they work and whether you can afford to take the high risk of losing your money. Automated and API trading can amplify losses through bugs, connectivity failures and runaway orders.

Returns one text property of a deal in the account's history, by ticket.

- Function: `HistoryDealGetString()`
- Interface: MQL5
- Group: History
- Status: verified. Source: [mql5.com](https://www.mql5.com/en/docs/trading/historydealgetstring), checked 2026-10-12.

This is an MQL5 function, not an HTTP endpoint. It has no method, no path and no address to send a request to: it runs inside the MetaTrader 5 terminal, in a program written in MQL5. It is in no OpenAPI file on this site and the request builder does not list it.

## Signature

The 2 forms of the call on the vendor's page, with the vendor's comments taken out.

```mql5
string HistoryDealGetString(
  ulong ticket_number,
  ENUM_DEAL_PROPERTY_STRING property_id
)
```

```mql5
bool HistoryDealGetString(
  ulong ticket_number,
  ENUM_DEAL_PROPERTY_STRING property_id,
  string& string_var
)
```

## Arguments

- `ticket_number` (type ulong, required): The ticket of the deal.
- `property_id` (type ENUM_DEAL_PROPERTY_STRING, required): Which property to return, as a value of the ENUM_DEAL_PROPERTY_STRING enumeration.
- `string_var` (type string&, required): Only in the second form: the string variable that receives the value.

## Return value

- Type: `string, or bool in the second form`
- What comes back: The page gives two forms: one returns the value itself, the other returns true or false and writes the value into a variable passed by reference.

## Related MQL5 functions: History

- [HistoryDealGetDouble()](https://openbrokerapi.com/platforms/metatrader-5/functions/mql5-historydealgetdouble): Returns one floating point property of a deal in the account's history, by ticket.
- [HistoryDealGetInteger()](https://openbrokerapi.com/platforms/metatrader-5/functions/mql5-historydealgetinteger): Returns one integer or date property of a deal in the account's history, by ticket.
- [HistoryDealGetTicket()](https://openbrokerapi.com/platforms/metatrader-5/functions/mql5-historydealgetticket): Returns the ticket of the deal at a place in the loaded history, and selects that deal for the history deal functions.
- [HistoryDealSelect()](https://openbrokerapi.com/platforms/metatrader-5/functions/mql5-historydealselect): Selects one deal in the account's history by its ticket, so the history deal functions can read it.
- [HistoryDealsTotal()](https://openbrokerapi.com/platforms/metatrader-5/functions/mql5-historydealstotal): Returns how many deals are in the history that was last loaded.
- [HistoryOrderGetDouble()](https://openbrokerapi.com/platforms/metatrader-5/functions/mql5-historyordergetdouble): Returns one floating point property of an order in the account's history, by ticket.
- [HistoryOrderGetInteger()](https://openbrokerapi.com/platforms/metatrader-5/functions/mql5-historyordergetinteger): Returns one integer or date property of an order in the account's history, by ticket.
- [HistoryOrderGetString()](https://openbrokerapi.com/platforms/metatrader-5/functions/mql5-historyordergetstring): Returns one text property of an order in the account's history, by ticket.
- [HistoryOrderGetTicket()](https://openbrokerapi.com/platforms/metatrader-5/functions/mql5-historyordergetticket): Returns the ticket of the order at a place in the loaded history.
- [HistoryOrderSelect()](https://openbrokerapi.com/platforms/metatrader-5/functions/mql5-historyorderselect): Selects one order in the account's history by its ticket, so the history order functions can read it.
- [HistoryOrdersTotal()](https://openbrokerapi.com/platforms/metatrader-5/functions/mql5-historyorderstotal): Returns how many orders are in the history that was last loaded.
- [HistorySelect()](https://openbrokerapi.com/platforms/metatrader-5/functions/mql5-historyselect): Loads the account's history of deals and orders for a period of server time, so the other history functions have something to read.
- [HistorySelectByPosition()](https://openbrokerapi.com/platforms/metatrader-5/functions/mql5-historyselectbyposition): Loads the deals and orders that belong to one position, by the position's identifier.

## More on MetaTrader 5

- [All MetaTrader 5 functions](https://openbrokerapi.com/platforms/metatrader-5/functions): 78 documented here, grouped by what they do.
- [MetaTrader 5 API quickstart](https://openbrokerapi.com/platforms/metatrader-5/quickstart)
- [All MetaTrader 5 error codes](https://openbrokerapi.com/errors/mt5)
- [MetaTrader 5 API page](https://openbrokerapi.com/platforms/metatrader-5): The full record: access, authentication, limits and the source for each.

## Licence and how to cite

The records behind this page are all rights reserved. This file is the page itself, at its own address, in another format. It is not part of the CC BY 4.0 downloads listed at https://openbrokerapi.com/data. Quote from it with a link to the page.

Cite as: MQL5 HistoryDealGetString(). Broker API Hub, https://openbrokerapi.com/platforms/metatrader-5/functions/mql5-historydealgetstring, newest check 2026-10-12.

Where you rely on a single figure, cite the source and the checked date printed beside it as well. Where this page and a broker's own documentation differ, the documentation wins.
