Problem of CopyOpen()

 

Hi all,

see code:

string _symbol[6]={"EURUSD","EURJPY","USDJPY","AUDUSD","EURGBP","GBPUSD"};
double Open[];

void OnStart()
{
   ArraySetAsSeries(Open,true);
   ushort s=0;
   
   for(int j=0;j<200;j++)
   {
      CopyOpen(_symbol[s],_Period,TimeCurrent()-60,TimeCurrent(),Open);
      s++;
      if(s>5)s=0;
   }
   
}

 After run this script, terminal.exe will always occupy thread even though closed MT5 window. Is this a bug?

 
https://www.mql5.com/en/docs/series/copyopen
Documentation on MQL5: Timeseries and Indicators Access / CopyOpen
Documentation on MQL5: Timeseries and Indicators Access / CopyOpen
  • www.mql5.com
Timeseries and Indicators Access / CopyOpen - Documentation on MQL5
 
song_song:

Hi all,

see code:

 After run this script, terminal.exe will always occupy thread even though closed MT5 window. Is this a bug?

What is the goal of this loop, that makes no sense.

Why don't you check the returned valie of CopyOpen() to see if there is an error ?

 

Thank you for let me go back to 3 years ago  :D

 
song_song:

Thank you for let me go back to 3 years ago  :D

Oh, I miss it

By the way my questions deserve an answer :-)

 
angevoyageur:

Oh, I miss it

By the way my questions deserve an answer :-)

 

 

actually I have forgot what's the goal of that loop, it seems a little crazy.
 
song_song:
actually I have forgot what's the goal of that loop, it seems a little crazy.

Yes, it is a little crazy... instead of using the "j" index you somehow use the "s" index inside the for loop to do exatly what the "j" index is supposed to do...

Moreover, you set the "j" index to go untill 200, while you have only 6 symbols on your _symbol array.

Basically it is a "bulk" copy of the open values for the 6 symbols on the array (however, bad coded, IMO).

 

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 with a 1 hour rate after the first time they 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 with a 1 hour rate after the first time they are not updated anymore

I have almost deleted your post: Do not double post.
Reason: