[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 499

 
PapaYozh:


This is such a joke:

?


Why, buystoploss[4] must be found behind the highest high between 0 and 19 candles.

i2 is reset, only once, but where else do I have to reset it?

 
sss2019:


Why, buystoploss[4] should be found behind the highest high between 0 and 19 candles.

i2 is zeroed, only once, but where else do I need to zero it?

i2=0;
  for(i=0;i<7;i++)
    {
Alert("i = ", i);
    while(i2 <= 19)
      {
      if(High[i2]>buystoploss[i])
        {
        buystoploss[i]=High[i2];
        }
Alert("i2 = ", i2);
      i2++;
      }
    }
    Alert(" ",buystoploss[4]);

see what you get...

 
sss2019:


Why, buystoploss[4] should be found behind the highest high between 0 and 19 candles.

i2 is zeroed out, only once, but where else do I have to zero it out?

Here's a search for the maximum:

  i2=0;
  for(i=1;i<19;i++)
   {
     if(High[i]>High[i2])
        i2=i;
   }
   Alert(" ",i2);

Even better:

i2=iHighest(Symbol(),0,MODE_HIGH,20,0);
Alert(" ",i2);
 
ilunga:

see what you get...


I figured it out, I zeroed i2 after the while loop and everything worked as it should, but now I can't figure out the same search for the lowest minimum, it's a real BREAK! Please help. each variable sellstoploss[i] is assigned a value of 999 to find the minimum.

  i2=0;
  for(i=0;i<7;i++)
    {
    while(i2 <= 19)
      {
      sellstoploss[i]=999;
      if(Low[i2]<sellstoploss[i])
        {
        sellstoploss[i]=Low[i2];
        }
      i2++;
      }
    i2=0;
    }
 
PapaYozh:

Here's a search for the maximum:

Even better:


So I need the four highest highs to be found, for example the first from zero bar to 5, the second from zero bar to 10 etc.
 
sss2019:


Ah well, I understand what it is, did zeroing i2 after the while loop and everything is working as it should, but now I can not deal with the same search for the lowest minimum, there is a real BREAK! Please help.each variable sellstoploss[i] is assigned a value of 999 to find the minimum.

at least 20 times each cycle


PapaYozh 13.01.2012 10:23



Let the man reinvent the wheel, as long as he learns from his mistakes.

 
Even better:
OK, I found the error myself, how clever I am. Of course I could have used iHighest, but I didn't think of it right away, and now that I've made such a loop, I'll just erase it, too bad.
 
sss2019:
OK, I found the error myself, how clever I am. Of course I could have used iHighest, but I didn't think of it right away, and now that I've made such a loop, I'll just erase it, too bad.
Sometimes I just have to throw 3 or 4 thousand lines of code in the trash... and nothing...
 
artmedia70:
Sometimes you just have to throw 3-4 thousand lines of code in the bin... and nothing...

Where's that bin?
 
Good afternoon,
1. I want to open a position for 3-4% of my account according to my money management. Is there a calculator to calculate the required lot size for any pair (or at least the most popular pairs)? Or how do I manually calculate the lot size, for example EURUSD?
2. Terminal Help does not explain what is the "Level" calculated on the "Terminal/Trading" tab. Who will explain what it means?

Reason: