[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 1025

 
Well, I know how cycles work.
 
eddy:
well i know how loops work

What's the point of this offtopic then?

eddy 11.12.2010 15:59

i.e. if the terminal hangs when pasting the indicator, i.e. the loop is endless?

I don't know how to do it - it just reaches its logical end!

 
an infinite loop, by definition, has no end. the question was why the terminal hung up)
 
eddy:
"By definition, an infinite loop has no end. The question was why the terminal hung up.)

That's why it says "Example of an infinite loop with interruption."

And no one has heard the answer. "Yes. Read this script at the start, put it on the chart, it'll be much clearer. Example of an infinite loop with interruption."

 
    int per=1;   // узнать минимальный тф на баре i1st. per это period какбэ
 while(true)                    {
              //iLowest( на мин_тф, свеч внутри, iBarShift(                     )+1)
     int lowest=iLowest(NULL,per,1,Period()/per, iBarShift(NULL,per,Time[i1st-1])+1);
   if(pr(iLow(NULL,per,lowest))==pr(Low[i1st]))   // если (лоу лоуест бара == лоу кур_ТФ бара)
    { i1tf=per; break; }
// иначе - увеличивать тф:
      switch (per)           {
      case 1:  per=5;
      case 5:  per=15;
      case 15: per=30;
      case 30: per=60;
      case 60: per=240;
      case 240:   per=1440;
      case 1440:  per=10080;
      case 10080: per=43200; }  }

and this one's off-start:

 int pr(double n)       {    //  p=MathRound(1.0/Point);
 int p=MathRound(1.0/Point); //  1/0.01 = 100;
 return(MathRound(n*p));}    //  95.00*100=9500;

why isn't the cycle interrupted?

 
How do I refer to the VininI_HMA indicator (and others that draw a line in different colours) to get the colour of the line ?
 
eddy:

why isn't the cycle interrupted?

does anyone know? the terminal hangs when an indicator is inserted, if this cycle is in it.
 
eddy:
no one knows? the terminal hangs when an indicator is inserted, if this cycle is in it.

You know how loops work ;))https://book.mql4.com/ru/operators/while

   while(true)  а здесь условия                  {
              //iLowest( на мин_тф, свеч внутри, iBarShift(                     )+1)
     int lowest=iLowest(NULL,per,1,Period()/per, iBarShift(NULL,per,Time[i1st-1])+1);
   if(pr(iLow(NULL,per,lowest))==pr(Low[i1st]))   // если (лоу лоуест бара == лоу кур_ТФ бара)
    { i1tf=per; break; }
// иначе - увеличивать тф:
      switch (per)           {
      case 1:  per=5;  тут должны быть break;
      case 5:  per=15;тут должны быть break;
      case 15: per=30;
      case 30: per=60;тут должны быть break;
      case 60: per=240;
      case 240:   per=1440;тут должны быть break;
      case 1440:  per=10080;
      case 10080: per=43200; }  
тут должны быть break; который прервет цикл но зачем тогда цикл?
}
 
lagriv:
How do I refer to the VininI_HMA indicator (and others that draw a line in different colours) to get the colour of the line ?

About right, hurry up.

if(iCustom(0,0,"VininI_HMA",period,method,price,sdvig,1,0)==EMPTY_VALUE)
color Green
if(iCustom(0,0,"VininI_HMA",period,method,price,sdvig,2,0)==EMPTY_VALUE)
color Red
if(iCustom(0,0,"VininI_HMA",period,method,price,sdvig,1,0)==EMPTY_VALUE&&
   iCustom(0,0,"VininI_HMA",period,method,price,sdvig,2,0)==EMPTY_VALUE)
color Yellow
 

why do I need a break in the switch?

It's written, it's necessary for increasing the tenf. When the low bar of the current tenf coincides with the low bar of the current tenf, the cycle should be interrupted.