Community of Expertise - page 6

 
What difference do you want to find? Array difference? So arrays cannot be added or subtracted. find the difference element by element.
 
What difference do you want to find? Array difference? So we can't add or subtract arrays. find the difference element by element.


It's just not clear to us chukchi why you say we are trying to subtract arrays, we do as shown in the MKL4 dictionary:


double macurrent=iMAOnArray(ExtBuffer,0,5,0,MODE_LWMA,0);
   double macurrentslow=iMAOnArray(ExtBuffer,0,10,0,MODE_LWMA,0);
   double maprev=iMAOnArray(ExtBuffer,0,5,0,MODE_LWMA,1);
   double maprevslow=iMAOnArray(ExtBuffer,0,10,0,MODE_LWMA,1);
   //----
   if(maprev<maprevslow && macurrent>=macurrentslow)
     Alert("crossing up");



Please, advise!

 
Thanks, Slava, for the tip.

Here's the code with the error

ArrayCopySeries(ma_C, MODE_CLOSE, "EURUSD", PERIOD_H1);
double ma_6C=iMAOnArray( ma_C, 0, 3*MA_period,0,MODE_SMA,1 );



And here's a worker

ArrayCopySeries(ma_C, MODE_CLOSE, "EURUSD", PERIOD_H1);

 ma_6C=ma_C[1];

for(i=2; i<(3*MA_period); i++)
   {
      ma_6O+=ma_O[i];
      ma_6C+=ma_C[i];
   }

ma_6C/=(3*MA_period);
 
The topic has been moved to http://forum.viac.ru/viewtopic.php?t=2973
 
The topic has been moved to http://forum.viac.ru/viewtopic.php?t=2973
 
The topic has been moved to http://forum.viac.ru/viewtopic.php?t=2973
 
A question for those familiar with the depths of MKL4.

Is there any standard command that allows the expert
to see the intersection of the averages. For example, an average of period 5 crosses an average
of period 20. Can the Expert Advisor see as a person the moment of crossing,
is there a standard function or command for this type of thing?

The figure below shows the intersection of the red and green averages as
It is an example of what the Expert Advisor should see and work on this signal.
 
M1 - first sliding,
M2 is the second sliding.

We need to compare the signs of differences (M1 - M2)
on the current and previous bars.
If they are different, it means that there is a crossover.
The special case is when one of the differences = 0.

You can do it like this
if ((M1[0] - M2[0]) != 0)
{ 
   double R = 0;
   for (int i = 1; i < Bars && R == 0; i++)  R = (M1[i] - M2[i]);
   if ((M1[0] - M2[0]) * R < 0)
   {
      // Знаки разные, есть пересечение ..........
   }
}



(haven't checked it myself)

 
...Is there any standard command that allows Expert Advisor<br / translate="no"> to see the crossover of averages.

there is no standard one.
Can the Expert Advisor see the time of crossover as a human,
is there a standard function or command for such things?

Easily
...as an example of what the Expert Advisor should see and work on this signal.

see iMAOnArray dictionary, there's even an example with intersection
just in case
   double macurrent=iMAOnArray(ExtBuffer,0,5,0,MODE_LWMA,0);
   double macurrentslow=iMAOnArray(ExtBuffer,0,10,0,MODE_LWMA,0);
   double maprev=iMAOnArray(ExtBuffer,0,5,0,MODE_LWMA,1);
   double maprevslow=iMAOnArray(ExtBuffer,0,10,0,MODE_LWMA,1);
   //----
   if(maprev<maprevslow && macurrent>=macurrentslow)
     Alert("crossing up");



2Sysadmin, the "enter" button is hidden again. Also, as far as I understand [pre] has been replaced with [code]?

 
Why are you having this operation and what does it do?

   for (int i = 1; i < Bars && R == 0; i++)  R = (M1[i] - M2[i]);