Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 254

 
ALXIMIKS:

from what works right. something else ?


so 19 low and 0 high is correct ?

what is 19 and what is 0 ?

personally i don't understand these numbers...we are talking about the MA difference array...where does 19 come from ?

 
lottamer:


so 19 low and 0 high is correct?

why 19 and 0 ?

I personally don't understand these numbers...we're talking about the MA difference array...where did 19 come from?

After filling the array in the loop, make another loop where you print all the values from the array. The log will show what values are there.

 

If you use ArrayMaximum, make sure you at least read what the function returns. (not the value, but the number of an array member ).

Arrays are just for general development, if you have any more questions.

Everything works properly.


 
ALXIMIKS:

If you use ArrayMaximum, make sure you at least read what the function returns. (not the value, but the number of an array member ).

Arrays are just for general development, if you have any more questions.

Everything works properly.



sorry... got it.
 
mzk_3om6u:

RYESPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPSPS


It is utf-8. It's a W3C standard, so it's possible the file was derived from the Internet or parsed. The MT4 standard is ANSI. In this case, I would write a converter from utf-8 to ANSI and read it byte-by-by-byte, as binary. Two bytes to the converter, two bytes to the converter... If the file was received locally (although I can't imagine such a case, unless it's not Notepad), just make sure that the file is saved in the correct encoding.

Another thought... Maybe it's a Lucida Unicode or Arial Unicode typeface, in which case mess around with the fonts.

 
ALXIMIKS:

If you use ArrayMaximum, make sure you at least read what the function returns. (not the value, but the number of an array member ).

Arrays are just for general development, if you have any more questions.

Everything works properly.


I add THIS.... and it prints 5__13 again. Shouldn't there already be indicator values?
 Maximum=iMACD(NULL, 0, 12,26,9,PRICE_CLOSE,MODE_MAIN,max);                    
 Minimum=iMACD(NULL, 0, 12,26,9,PRICE_CLOSE,MODE_MAIN,min);  
  
  Print(Minimum,"___",Maximum);
 
lottamer:
I add THIS.... and it prints 5__13 again. Shouldn't there already be indicator values?

int start(){
   double MACDBuffer[20];
   int min,max;
   for(int i=0; i<20; i++){
      MACDBuffer[i]=iMA(NULL,0,12,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,26,0,MODE_EMA,PRICE_CLOSE,i);
      Print (MACDBuffer[i]);
   }
   min=ArrayMinimum(MACDBuffer);
   max=ArrayMaximum(MACDBuffer);
   Print(MACDBuffer[min],"____",MACDBuffer[max]);
}
 
mzk_3om6u ,here's a BASIC converter on the hub, you can translate it on the spot.
 
ALXIMIKS:


thanks, can not verify it.... at first the advisor glitched (did not respond to the apologies in the code). decided to restart mt4 - the terminal opened clean as a child's tear.... no accounts, no charts, no advisors.... new decks are not opening....

I guess that's a sign - TODAY is over :)))

thanks for your patience.... :)

 
lottamer:


thanks, can't check.... first the advisor glitched (didn't respond to the apologies in the code). decided to restart mt4 - the terminal opened clean as a child's tear.... no accounts, no charts, no EAs....

this must be a sign - THAT'S ENOUGH FOR TODAY. :)))

thanks for your patience.... :)

Wandering, in three pines.

Here's I. Kim's function, sort it out

//+------------------------------------------------------------------+
//| Дивергенции MACD основной линии                                  |
//| Параметры:                                                       |
//|   nb - номер бара                                                |
//|   ms - массив сигналов                                           |
//+------------------------------------------------------------------+
void DivergenceMACDMain(int nb, double& ms[]) {
  double mu1, mu2, md1, md2;
  double pu1, pu2, pd1, pd2;
  double tt[];
  int    sh;

  ArrayResize(tt, BarsForCheck);
  // Заполнение массива точек.
        for (sh=0; sh<BarsForCheck; sh++) {
                tt[sh] = iMACD(NULL, 0, FastEMAPeriod, SlowEMAPeriod, MACDSMAPeriod, PRICE_CLOSE, MODE_MAIN, nb+sh);
        }
  // Определение ключевых точек.
        mu1=0; mu2=0; pu1=0; pu2=0;
        for (sh=0; sh<BarsForCheck; sh++) {
                if (tt[sh+1]<tt[sh+2] && tt[sh+2]>tt[sh+3]) {
                        if (mu1!=0 && mu2==0) {
                          mu2 = tt[sh+1];
                          pu2 = High[nb+sh];
                        }
                        if (mu1==0 && tt[1]<tt[2] && tt[2]>tt[3]) {
                          mu1 = tt[sh+1];
                          pu1 = High[nb+sh];
                        }
                }
        }
        md1=0; md2=0; pd1=0; pd2=0;
        for (sh=0; sh<BarsForCheck; sh++) {
                if (tt[sh+1]>tt[sh+2] && tt[sh+2]<tt[sh+3]) {
                        if (md1!=0 && md2==0) {
                          md2 = tt[sh+1];
                          pd2 = Low[nb+sh];
                        }
                        if (md1==0 && tt[1]>tt[2] && tt[2]<tt[3]) {
                        md1 = tt[sh+1];
                          pd1 = Low[nb+sh];
                        }
                }
        }

  // Сигнал на покупку
  if (pd1<pd2 && md1>md2 && md1<0 && md2<0) {
    ms[0] = Low[nb] - ArrowInterval * Point;
    ms[4] += 4;
  }

  // Сигнал на продажу
  if (pu1>pu2 && mu1<mu2 && mu1>0 && mu2>0) {
    ms[1] = High[nb] + ArrowInterval * Point;
    ms[4] += 4;
  }
}