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

 
Cmu4:

I haven't come across it, but it is possible to write... this would be about right for the maximum value of the main masd line over the last 10 bars, not counting the current one:


Small correction

double Hi (int pos=0)
{ 
  int i=pos; 
  double H=0;
  while (i<=pos+10)
  {
    if (H<iMACD (NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,i)) 
      H=iMACD (NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,i);
    i++;
  }
  return(H);
}
 
How can I find out the maximum value of the st. Dev indicator for the last 10 bars (not counting the current one)?
 
sergeev:
you do not check the value by -1

Bingo!

Much obliged! ))

 
Vinin:


Small correction.

And how will it differ from my variant, in terms of operability?

p.s. Yeah, by the way, this function doesn't need to be performed on every tick, it's enough when a new bar opens. Serious increase in speed.

 
Cmu4:

And how would it differ from my version, in terms of performance?


Both yours and his are counting 11 bars for some reason, and I need 10.)
 
Roger:

Both you and he are counting 11 bars for some reason, but I need 10.)
No, it counts 10. But from the 1st. :)
 
Cmu4:

And how will it differ from my version, in terms of operability?

p.s. Yes, by the way, this function doesn't need to be performed on every tick, it's enough when a new bar opens. A serious increase in speed.


At least because the double H type is used;
 
Vinin:

If only because the double H type is used;
So yeah... Never mind.
 

Testing and optimisation are two different things?



144
eugene-last 25.09.2011 14:10
if(IsTesting() == true){
  if(IsVisualMode() == false || IsOptimization() == true){test = true;}
}

Meaning if I test first test equal to trut, and optimization is not testing - it turns out that if there is optimization, then I do not get to the second condition?! And as a result, the run goes through the full program and not as in test mode....

The trick here is simple. If there is a visualisation, the EA draws objects on the chart and it eats a lot of time. Therefore, we should draw objects during testing with the VISUALIZATION but not without it. But is it the same as optimization!

 
sergeev:

Testing and optimisation are two different things?



144
eugene-last 25.09.2011 14:10

Meaning if I test first test equal to trut, and optimization is not testing - it turns out that if there is optimization, then I do not get to the second condition?! And as a result, the run goes through the full program and not as in test mode....

The trick here is simple. If there is a visualization, the EA draws objects on the chart and it eats a lot of time. Therefore, we should draw objects during testing with the VISUALIZATION but not without it. But is it the same as optimization!


Objects are not drawn in principle during optimisation.
Reason: