How to release memory after massive CopyRates()? - page 6

 
Flohti #:

Have you tried Print the number of ticks returned by the function, I have, with the from parameter set, it returns 2000 ticks, CopyTicksRange, if returns effectively something return all the ticks required, not CopyTicks, I had an all-in-one function to do the job in all circumstance, CopyTicksRange first, if no ticks, a loop with CopyTicks, and in that loop, from and to was set, and only 2000 ticks was returned per loop, it is said in the doc "not more than 2000", it's not specific to that case on not specifying from and count, or to_msc

I have no idea why you insist about this "2000".

void OnStart()
 {
//---
  MqlTick ticks[];
  datetime fromDT = D'2025.12.01';
  ulong from      = ulong(fromDT)*1000;
  ulong to        = ulong(TimeCurrent())*1000;

  int copied      = CopyTicks(_Symbol,ticks,COPY_TICKS_ALL,from,10000);
  printf("CopyTicks : %i copied",copied);
  int rangeCopied = CopyTicksRange(_Symbol,ticks,COPY_TICKS_ALL,from,to);
  printf("CopyTicksRange : %i copied",rangeCopied);
 }

2025.12.19 10:44:51.904    Ticks (USDCHF,H1)    CopyTicks : 10000 copied
2025.12.19 10:44:51.918    Ticks (USDCHF,H1)    CopyTicksRange : 524549 copied

 
Alain Verleyen #:

I have no idea why you insist about this "2000".

2025.12.19 10:44:51.904    Ticks (USDCHF,H1)    CopyTicks : 10000 copied
2025.12.19 10:44:51.918    Ticks (USDCHF,H1)    CopyTicksRange : 524549 copied

Ok, I've not tested precise number of ticks, I always had 2000 max when I don't precise a count number