Problem with CopyOpen

 

Hi.

COuld anyone support me?

In the code below when I call copyopen the Time[] vector and OpenPrice[] vector are updated only the first time but every time void OnTimer is called later they are not updated anymore

#property copyright "Copyright 2021, MetaQuotes Ltd."
#property link      "https://www.mql5.com"
#property version   "1.00"

int dim = 3505;
double OpenPrice[3505];
datetime Time[3505];
//MqlTick last_tick;
datetime timenow;

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+


int OnInit()
{
//--- create timer
EventSetTimer(3600);
   
//---
return(INIT_SUCCEEDED);

}

//+------------------------------------------------------------------+
//| Timer function                                                   |
//+------------------------------------------------------------------+
void OnTimer()
  
  {   timenow=TimeTradeServer();
      
      CopyOpen("EURUSD",PERIOD_H1,timenow,dim,OpenPrice);
      CopyTime("EURUSD",PERIOD_H1,timenow,dim,Time);
      
           
  }

hey are not updated anymore

 
mvalue:

Hi.

COuld anyone support me?

In the code below when I call copyopen the Time[] vector and OpenPrice[] vector are updated only the first time but every time void OnTimer is called later they are not updated anymore

hey are not updated anymore

Both wont change for one hour (because of the timeframe Period_H1) no matter how often you are calling them.
 
Carl Schreiber #:
Both wont change for one hour (because of the timeframe Period_H1) no matter how often you are calling them.
I forgot. I'm operating in debugging mode. 

I set eventsettimer=3600 in oninit so void ontimer is called every 1 hour. 
In the correct way the variabile timenow increase of 1 hour everytime the void ontimer is called ( I checked) but that not happen for  the arrays ( Time and Openprice) output of copyone. It's so strange... If the input ( timenow) of copyone change why its output ( Time and Open Price) do not? 
 
Try to debug with hist. Quotes (Strg+F5).
 
Carl Schreiber #:
Try to debug with hist. Quotes (Strg+F5).
I'm operating in debugging mode with historical data. If you can try to test my code on your metaeditor. Thanks in advance for your support.