Questions from a "dummy" - page 104

 
220Volt:
Thanks, looks like it's time to burn great-grandpa's book ))))

From history: great-grandpa's book specifically left long=int for old software compatibility.

At one time we decided too - to leave "useless" long as int and introduce inhuman int64 (or long int) or to do "correctly" by using pure long. As a result, we decided that the correct procedure is to use long as a 64-bit integer.

Long is not always 32 bit in other systems. Even the same compiler for different architectures uses different sizes. That's what Intel C++ has:

The size of a "long" integer varies between architectures and operating systems.

The Intel Compiler is compatible and inter-operable with Microsoft* Visual C++ on Windows* and
with gcc* on Linux* and Mac OS X*. Consequently, the sizes of fundamental types are the same as
for these compilers. The size of  a long integer in particular depends on the operating system
and the targeted architecture as follows:

   OS         arch           size
----------------------------------
Windows       IA-32        4 bytes
Windows       Intel 64     4 bytes
Windows       IA-64        4 bytes
Linux         IA-32        4 bytes
Linux         Intel 64     8 bytes
Linux         IA-64        8 bytes
Mac OS X      IA-32        4 bytes

Mac OS X        Intel 64       8 bytes


In MQL5 we use the x64 bit compatible architecture that requires the same behavior both in 32 and 64 bits. long is 64 bit for that reason as well.


A little more history, if you remember: in the days of MSDOS, int was 16-bit and equal to short in 16-bit compilers. When the programmer moved to the 32-bit platform, int was extended to 32 bits and became equal to short. It seems that there were no particular complaints. When we moved to 64 bits, long had to be detached from int. And it is logical.

 

MqlRates rates[];

I need to find the maximal value of rates[].high from the last three bars

I don't know how to applyArrayMaximum to the structure?

 
dentraf:

MqlRates rates[];

I need to find the maximal value of rates[].high from the last three bars

I don't know how to applyArrayMaximum to the structure?

As far as I know, this function works only with numeric arrays, so write your own function to mess with the structure.
 
dentraf:

MqlRates rates[];

I need to find the maximal value of rates[].high from the last three bars

I don't know how to applyArrayMaximum to the structure?

double MaxHigh(const MqlRates& rates,int &index)
  {
   double max=0.0;
   index=-1;
//--- check
   if(ArraySize(rates)<3) return(EMPTY_VALUE);
//--- loop
   for(int i=0;i<3;i++)
      if(max<rates[i].high)
        {
         max=rates[i].high;
         index=i;
        }
//--- result
   return(max);
  }
It goes like this. ArrayMaximum does not apply to the structure.
 
uncleVic:
Something like this. ArrayMaximum does not apply to the structure.
Thank you!
 

what does it mean ?

CExpertBase::SetOtherSeries: changing of timeseries is forbidden

 
CExpertBase::SetOtherSeries: changing of timeseries is forbidden
what could this mean?
 

Tell me please.

Given:

  • Two processes (#1 and #2);
  • running in parallel;
  • memory space of the UE;
  • at one moment (on one cycle), the processes try to do the following:

1. No.1 write to the UE and No.2 read;

2. Write #1 and #2 into the UE;

Question: which situation is in conflict? I am more interested in case #1, can we consider it normal, or should access be restricted? I suspect that the 1st case is not good, what will the conflict look like, unclear value, or expect something more serious?

 
openlive:
CExpertBase::SetOtherSeries: changing of timeseries is forbidden
What does this mean?
A little more detail... What is the next line (preferably several) in the log?
 

220Volt:

Question: which situation is a conflict situation? I'm more interested in case 1, can this be considered normal, or should access be restricted? I suspect that case 1 is not good, what would the conflict look like, an unclear value, or should I expect something more serious?

Both situations will be in conflict, with an unclear value.