# MQL5 CopyTicks()

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-copyticks, 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.

Copies ticks of a symbol into an array of MqlTick structures, from a time onwards or the most recent ones. The oldest tick copied is at index 0.

- Function: `CopyTicks()`
- Interface: MQL5
- Group: Bars and ticks
- Status: verified. Source: [mql5.com](https://www.mql5.com/en/docs/series/copyticks), 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.

Note: The page says the first call for a symbol starts synchronising the terminal's stored ticks with the trade server, and ticks the terminal lacks are downloaded.

## Signature

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

```mql5
int CopyTicks(
  string symbol_name,
  MqlTick& ticks_array[],
  uint flags=COPY_TICKS_ALL,
  ulong from=0,
  uint count=0
)
```

## Arguments

- `symbol_name` (type string, required): The symbol.
- `ticks_array` (type MqlTick&[], required): The array of MqlTick that receives the ticks.
- `flags` (type uint, optional): Which ticks to copy: COPY_TICKS_INFO for ticks that change the bid or ask, COPY_TICKS_TRADE for ticks that change the last price or volume, COPY_TICKS_ALL for all of them. Default: COPY_TICKS_ALL.
- `from` (type ulong, optional): The time to copy from, in milliseconds since 1 January 1970. With 0, the most recent ticks are returned, as many as count asks for. Default: 0.
- `count` (type uint, optional): How many ticks to copy. The page says that when neither from nor count is given, the most recent ticks are returned, up to 2,000 of them. Default: 0.

## Return value

- Type: `int`
- What comes back: The number of ticks copied, or -1 on an error.

## Sample

Written by this site from the signature and arguments recorded on this page. It has not been run against a terminal, a server or an account, and the values in it are placeholders. It holds no credential and needs none: the program runs inside a terminal that is already logged in to an account. Nothing is entered on this site.

```mql5
void OnStart()
  {
   MqlTick ticks[];
   int copied=CopyTicks(_Symbol,ticks,COPY_TICKS_INFO,0,100);
   if(copied<0)
      PrintFormat("CopyTicks error %d",GetLastError());
   else if(copied>0)
      PrintFormat("%d ticks, newest bid %.5f",copied,ticks[copied-1].bid);
  }
```

## Related MQL5 functions: Bars and ticks

- [CopyRates()](https://openbrokerapi.com/platforms/metatrader-5/functions/mql5-copyrates): Copies historical bars of a symbol and timeframe into an array of MqlRates structures, by start position and count, by start time and count, or between two times.
- [CopyTicksRange()](https://openbrokerapi.com/platforms/metatrader-5/functions/mql5-copyticksrange): Copies the ticks of a symbol between two times into an array of MqlTick structures. The oldest tick copied is at index 0.

## 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 CopyTicks(). Broker API Hub, https://openbrokerapi.com/platforms/metatrader-5/functions/mql5-copyticks, 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.
